Questions tagged as 'data.frame'

2
answers

Function using as successive values of a column (R)

I have a data.frame with 13 columns and 78 rows. I need to do for each column ((x1/x2)^12)-1 , being x1 the value contained in the first row of the first column, x2 the value contained in the second row of the first co...
asked by 04.06.2014 / 22:12
2
answers

Reorder the categories in a data frame

When we import data into R it sorts the categories alphabetically. How do I change this order? Suppose it is the following data: df <- data.frame(categorias=c("Muito baixa","Baixa","Média","Alta","Muito alta"), valores=s...
asked by 02.04.2014 / 19:17
1
answer

Export R data to Excel formatted

Assume a data.frame like this: tabela <- structure(list(vendedor = structure(1:4, .Label = c("A", "B", "C", "D"), class = "factor"), Total = c(3300, 440, 1020, 200)), .Names = c("vendedor", "Total"), row.names = c(NA, -4L), class =...
asked by 23.04.2014 / 02:08
3
answers

How to sort a data.frame by columns in R?

Suppose a data.frame with numeric values and strings: set.seed(1) dados <- data.frame(w=rep(c("A", "B"), 2), x= rep(c("D", "C"), 2), y= rnorm(4), z=rnorm(4), stringsAsFactors=FALSE) dados w x y z 1 A...
asked by 17.02.2014 / 18:51
4
answers

How to join observations of tables that have a different set of variables in R?

In the case below id corresponds to observations contained in two different data frames, where in df1 the observations have the variable x and in df2 the observations have x and z In these cases how to join the two data frames? rbind...
asked by 14.01.2016 / 18:34
2
answers

How to create a for in R with the indexes of a data frame

If I have a data.frame: > dato<-as.data.frame(matrix(1:64,8,8,T))[-3,] > dato V1 V2 V3 V4 V5 V6 V7 V8 1 1 2 3 4 5 6 7 8 2 9 10 11 12 13 14 15 16 4 25 26 27 28 29 30 31 32 5 33 34 35 36 37 38 39 40 6 41 42 43 44 45 46 47 48...
asked by 01.05.2018 / 16:15
2
answers

Rename the levels of a factor based on a data frame

Suppose I have the date frame iris , present in the memory of R: head(iris) Sepal.Length Sepal.Width Petal.Length Petal.Width Species 1 5.1 3.5 1.4 0.2 setosa 2 4.9 3.0 1.4...
asked by 02.12.2017 / 20:11
2
answers

How to remove a column from the data.frame in R?

Suppose a generic data.frame, such as: set.seed(1) dados <- data.frame(y=rnorm(100), x= rnorm(100), z=rnorm(100), w=rnorm(100)) head(dados) y x z w 1 -0.6264538 -0.62036668 0.4094018 0.8936737 2 0.1...
asked by 17.02.2014 / 18:10
2
answers

Convert a list with dataframes of different rows into independent dataframes [R]

I have a list of 3 dataframes, which are derived from the split function: > split $'1' bin group1 group2 missing score1 score2 gender size score3 income city 0 1 1 NA 3 2 M S 4 1605....
asked by 21.08.2018 / 03:35
1
answer

What are columns-list of a data.frame?

tidyverse encourages the use of list-columns in < a data / data / data.frames "class=" post-tag "title=" show questions tagged 'data.frames' "> data.frames . But, after all, What are columns-lists? On what occasions are they commonly...
asked by 26.12.2018 / 14:31