Skip to content
Prev 257418 / 398506 Next

Simple question

On Apr 19, 2011, at 3:19 PM, Steven Wolf wrote:

            
It produces a list. To return an unlist-ed version, what else?
 > unlist(list)
[1] "1" "1" "2" "3" "5" "8"

And to make it a numeric vector ... also simple:
 > as.numeric(unlist(list))
[1] 1 1 2 3 5 8
 > vec <- as.numeric(unlist(list))
 > vec == c(1,1,2,3,5,8)
[1] TRUE TRUE TRUE TRUE TRUE TRUE
 > all.equal(vec , c(1,1,2,3,5,8) ) # better practice with numeric  
values
[1] TRUE
 > identical(vec , c(1,1,2,3,5,8) )
  # will not be true in all situations where newbs think it will be
[1] TRUE