开发者

What's the best way to melt a list into a vector?

开发者 https://www.devze.com 2023-03-30 15:51 出处:网络
I\'d like to melt this: test = list( one = \"joe\" , two = c( \"john\" , \"jane\" ) ) Into a character vector:

I'd like to melt this:

test = list( one = "joe" , two = c( "john" , "jane" ) )

Into a character vector:

c( "joe" , "john" , "jane" )

I tried melt() in the reshape package, but that results in a data.frame where strings are treated as factors, so I'd have to do something like:

as.character( melt( test )$v开发者_运维知识库alue )

Is there a shorter/faster way?


unlist(test)

(my answer needs to be more than 30 characters!)

0

精彩评论

暂无评论...
验证码 换一张
取 消