Reputation: 765
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.
Upvotes: 1
Views: 114
Reputation: 887251
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)
Upvotes: 2