Entering edit mode
jian_liangli
•
0
@jian_liangli-11294
Last seen 8.0 years ago
Hi,
I have a list where each list element is IntegerList, I want to coerce IntegerList object to vector. I tried of using as.vector
function, but it is still not simplified as I expected. How can make this happen? Any idea?
I tried as follow, but output is not what I expected:
lapply(myList, as.vector)
# mini example:
myList <- list( a=IntegerList(1,2,3,4), b=IntegerList(3,4,integer(0),integer(0)), c=IntegerList(1,4,6,7) )
# desired output:
desired_output <- list( a=c(1,2,3,4), b=c(3,4,0,0), c=c(1,4,6,7) )
How can I achieve me desired output? Can anyone propose possible idea to make this coercion happen easily? Thanks
Thanks, your answer helped.