-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
This is a reproducible example for combining a list of datasets into a single data frame.
year1 <- data.frame(
id = c(1,2),
var1 = c(11,12),
var2 = c(22,23 )
)
year2 <- data.frame(
id = c(1,2),
var1 = c(33,34),
var2 = c(44,45),
var3 = c(55,56)
)
dto <- list(
`1` = year1,
`2` = year2)
ds <- plyr::ldply(dto,data.frame, .id = "year")
> ds %>% dplyr::arrange(id)
year id var1 var2 var3
1 1 1 11 22 NA
2 2 1 33 44 55
3 1 2 12 23 NA
4 2 2 34 45 56
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels