Displaying 2 results from an estimated 2 matches for "flatlist".
2012 Jun 26
2
flatten lists
...ar to unlist, however I don't want to turn it
into a vector because then everything will be casted to character
vectors:
x <- list(name="Jeroen", age=27, married=FALSE,
home=list(country="Netherlands", city="Utrecht"))
unlist(x)
This function sort of does it:
flatlist <- function(mylist){
lapply(rapply(mylist, enquote, how="unlist"), eval)
}
flatlist(x)
However it is a bit slow. Is there a more native way?
2012 Aug 01
4
apply function over same column of all objects in a list
Hello. Please forgive me if this problem has already been posted (and solved)
by someone else ... I can't find it anywhere though it seems so very basic.
Here it is:
I have a list comprised of several matrices, each of which has two columns.
> list
[[1]]
[,1] [,2]
[1,] 1 3
[2,] 2 4
[[2]]
[,1] [,2]
[1,] 5 7
[2,] 6 8
[[3]]
[,1] [,2]