Questions tagged as 'r'

2
answers

Selecting part of a data frame and saving in loop

I have a date frame of more than 1000 rows and two columns (col1 and col2). How do I select n date frames based on column 2 (just the same elements) through a loop and then save the n data.frames (df1, df2, ... dfn ) in a tb directory in the loo...
asked by 10.07.2017 / 07:46
2
answers

combine vectors per row in R by filling empty spaces

I have two vectors: a <- c(1,2,3,4) b <- c(1,2) I want to create an array by combining the vectors per line as follows: 1 2 3 4 1 2 0 0 That is, join two vectors per line and fill in empty spaces.     
asked by 11.08.2017 / 21:14
2
answers

How to do the Hosmer-Lemeshow test in R?

I have a set of data to make the logistic regression of the dependent childbirth variable that is qualitative binary. With the command below I get the multivariate logistic model in the R program: GLM.1 <- glm(parto ~ trabalho + financia...
asked by 07.08.2017 / 20:26
1
answer

R - Select elements of a data frame with a column that has the same name as a global variable with 'dplyr'

Consider the following data.frame and variable x df <- data.frame(x = c(rep(0, 10), rep(1, 10)), y = 1:20) x <- 0 I tried to use dplyr to select elements from column x equal to global variable x li...
asked by 10.04.2018 / 22:53
2
answers

How to make a loop / routine for the write.fst () function?

I have the following files in my working directory: Dados_1.fst Dados_2.fst Dados_3.fst Dados_4.fst ... Dados_10.fst The file Data_x.fst (where x is from 1 to 10) has the columns CODE, INSCRIPTION, ANSWER_A, ANSWER_B Then I create the fo...
asked by 16.05.2018 / 21:28
2
answers

R: to which objects does the names () attribute apply?

I'm a little confused by the role of the names() attribute on different objects. In addition to the normal use in data.frames, I see examples of help(names) that can also be used for vectors (both numeric and string) and lists....
asked by 25.09.2014 / 21:00
2
answers

Join multiple files from a folder in R

I'm trying to join multiple xlsx files in R. To do this, first open the following libraries and use the programming: library(readxl) library(plyr) larquivos<-list.files("C:\Users\tomas.veiga\Documents\Financeiro\dados",full.names=TRUE) arqu...
asked by 09.12.2016 / 12:29
3
answers

How to change order of appearance of columns in a Data Frame?

I have this df mounted on the R: Produto Classificação Comun Quilo Indice 1 ABACAXI HAVAI A GRAUDO 3,32 2,2 2 2 ABACAXI HAVAI B MEDIO 2,81 1,8 3 3 ABACAXI HAVAI...
asked by 09.03.2017 / 19:30
1
answer

Error when trying to extract table from a site by R, how to solve?

I'm using this code, I want to import the country table into the R: library(XML) url <- "http://en.wikipedia.org/wiki/List_of_countries_by_population" country_data <- readHTMLTable(url, which=2) R returns the error: Error: failed to...
asked by 22.02.2017 / 20:56
1
answer

Plot Main Title com Text and formula y = a + betaX + Epsilon

These are the data: a=structure(c(2.96898844129164, 2.7849952585919, 2.4022019576164, 2.97749332978932, 3.23431466394159, 3.37620019711505, 3.3295390792587, 3.11646532271242, 2.84000702738219, 2.74301542351398, 2.07832874180711, 2.157405157...
asked by 26.11.2016 / 20:26