Displaying 1 result from an estimated 1 matches for "formula_wid".
Did you mean:
formula_wide
2012 Mar 19
0
Reshape data frame with dcast and melt
...data_long[!is.na(data_long$value), ]
# Resort data
formula_sort <- as.formula(paste("~", paste(ids, collapse="+")))
data_long <- sort(data_long, f = formula_sort)
return(data_long)
}
reshape_wide <- function(data, ids) {
# Bring data into wide form
formula_wide <- as.formula(paste(paste(ids, collapse="+"), "~
Data_Points"))
data_wide <- dcast(data, formula_wide)
# Resort data
formula_sort <- as.formula(paste("~", paste(ids, collapse="+")))
data_wide <- sort(data_wide, f = formula_sort)
re...