An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110126/4d1dbc1d/attachment.pl>
how could I choose subvector of a vector?
3 messages · Akram Khaleghei Ghosheh balagh, David Winsemius
On Jan 26, 2011, at 2:42 PM, Akram Khaleghei Ghosheh balagh wrote:
Hello ; How could I choose subvector of a vctor. for example if v=c(1,2,5,0,1), how could I chose the (1,2) or (1,2,5).
?"[" v[ c(1,2,5) ]
thanks; [[alternative HTML version deleted]]
______________________________________________ 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.
David Winsemius, MD West Hartford, CT
On Jan 26, 2011, at 2:48 PM, David Winsemius wrote:
On Jan 26, 2011, at 2:42 PM, Akram Khaleghei Ghosheh balagh wrote:
Hello ; How could I choose subvector of a vctor. for example if v=c(1,2,5,0,1), how could I chose the (1,2) or (1,2,5).
?"[" v[ c(1,2,5) ]
I didn't notice at first that you wanted the values 1,2,5 ...(thought you wanted the 1st 2nd and 5th (obviously not correct with only a 4 element vector)... so your values would be accessed with v[1:3]
thanks; [[alternative HTML version deleted]]
David Winsemius, MD West Hartford, CT