I'm trying to remove dependency on plyr and have a line which uses the dlply
function.
translation <- dlply(data ,.(key), function(s) key = as.list(s))
I've tried to use lapply
and split
based on a previous answer but cannot work out how to translate the key and as.list parts.
CodePudding user response:
If we want to get similar structure, use split
and then unclass
lapply(split(data, data$key), unclass)
-testing
lapply(split(head(mtcars), head(mtcars)$cyl), unclass)