Questions tagged as 'data.frame'

2
answers

Problems with merge function

I'm having trouble with the merge function of nothingness, it stopped merging the data.frames. It seems like instead of using say cbind , it is using rbind and what is worse triple echo (each = 3). For two data.frames of 4...
asked by 13.02.2018 / 02:29
1
answer

Transform columns into rows in a dataframe

I have a dataframe with columns: LUC Contrato Fantasia Ano Mes 01 02 03 05 ... 30 Tatividade I need to turn these columns with the days of the month into rows. In each column has the value sold that day by the store. It would have to look...
asked by 06.12.2017 / 02:03
2
answers

Use values from a dataframe in ifelse

I have the following scenario: Data frame - Resources: recursos <- as.data.frame(c("server01","server02","server03")); colnames(recursos) <- "Server" Data frame - Events: eventos <- as.data.frame(c("falha no server01","e...
asked by 04.05.2017 / 19:23
1
answer

Rearrange Row Order dataframe

I have the respective data.frame in the R: Produto Classificação Comum Quilo 1 ABACAXI HAVAI A GRAUDO 3,32 2,2 2 ABACAXI HAVAI B MEDIO 2,81 1,8 3 ABACAXI HAVAI C MI...
asked by 09.03.2017 / 22:30
0
answers

How to fix error "can not coerce class" "group" "to a data.frame"

When running script below, specifically in the playback part of data.frames , the error was returned:    Error in as.data.frame.default (x [[i]], optional = TRUE,   stringsAsFactors = stringsAsFactors):         can not coerce c...
asked by 17.09.2018 / 21:43
1
answer

How to insert, as a new column, names in a vector in R?

I have a vector, called istrain , with names: istrain = c("carri", "challeng", ...) And I want to turn them into columns of a dataframe, testSparse, which contains word frequency frequencies in comments, something like: testSparse$cool =...
asked by 22.12.2017 / 16:32
2
answers

Insert vector value from a data.frame into another data.frame [duplicate]

I have two data frames. The first one has 2185 observations and the second has only 9. The first data frame whose name is dados contains the following variables: local , parc , arv , DAP , Ht , Hf...
asked by 12.09.2017 / 03:38
2
answers

Look up values in one data.frame and add in another (R)

I have 2 data.frames, the first is a data.frame that contains stock data and a column with a unique identifier (column "ISIN") , as shown below: > Teste=data.frame(matrix(runif(20), nrow=5, ncol=4)) Teste$ISIN <- c("A1","A2","A3","A4","A5"...
asked by 19.04.2016 / 21:30
1
answer

How to send data frames data in code questions in optimized R?

Edited - As pointed out in Marcos Moraes' comment, I tried to reinvent the wheel of an available resource in the base layer of R, since dput is capable of producing the same effect. Our failure. :( The central question of my question still rema...
asked by 29.10.2016 / 13:43
1
answer

How to create a column in R under specific conditions?

Consider the following data.frame: data <- data.frame(x=c("a","b","c","d"), y=c(2,2,1,2),w=c(4,4,2,2),z=c(25,16,24,30), k=c("sim","nao","sim","nao")) How to include a new column where we will have value 1 for the lines with y = 2, w = 4...
asked by 14.11.2017 / 23:14