Re: [R] Extract values from a named array

From: Uwe Ligges <ligges_at_statistik.tu-dortmund.de>
Date: Mon, 07 Apr 2008 18:50:21 +0200

Gang Chen wrote:
> Sorry for this dumb question. Suppose I have a named array ww defined as
>
> ww <- 1:5
> names(ww) <- c("a", "b", "c", "d", "e")
>
> How can I extract the whole array of numbers without the names?
> ww[1:5] does not work while ww[[1]] can only extract one number at a
> time.

Use as.vector to strip these attributes:

as.vector(ww)
> Thanks,
> Gang
>
> ______________________________________________
> R-help_at_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.



R-help_at_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. Received on Mon 07 Apr 2008 - 16:57:04 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 07 Apr 2008 - 17:30:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive