unlist()

Michael Weylandt

On Wed, Aug 10, 2011 at 2:58 PM, Liviu Andronic <landronimirc@gmail.com>wrote:

> Dear all
> How does one convert a "non-symmetric" list to a vector? See below:
>
> > x <- list()
> > x[[1]] <- letters[1:5]
> > x[[2]] <- letters[6:10]
> > x[[3]] <- letters[11:12]
> > x
> [[1]]
> [1] "a" "b" "c" "d" "e"
>
> [[2]]
> [1] "f" "g" "h" "i" "j"
>
> [[3]]
> [1] "k" "l"
>
> > paste(x)
> [1] "c(\"a\", \"b\", \"c\", \"d\", \"e\")" "c(\"f\", \"g\", \"h\",
> \"i\", \"j\")"
> [3] "c(\"k\", \"l\")"
> > as.vector(x)
> [[1]]
> [1] "a" "b" "c" "d" "e"
>
> [[2]]
> [1] "f" "g" "h" "i" "j"
>
> [[3]]
> [1] "k" "l"
>
> > simplify2array(x)
> [[1]]
> [1] "a" "b" "c" "d" "e"
>
> [[2]]
> [1] "f" "g" "h" "i" "j"
>
> [[3]]
> [1] "k" "l"
>
>
> What I would need to get instead is:
> > letters[1:12]
>  [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l"
>
> Any ideas? Regards
> Liviu
>
>
> --
> Do you know how to read?
> http://www.alienetworks.com/srtest.cfm
> http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
> Do you know how to write?
> http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]

