My_Vector[names(My_Vector)=="a"]
-------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77840-4352
-----Original Message-----
From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org] On Behalf Of Christofer Bogaso
Sent: Tuesday, June 25, 2013 9:28 AM
To: r-help
Subject: [R] A question on vector
Hello again,
I have found that, in a vector if many elements have same names then
calling those elements with their names does not look complete. Here
is 1 example:
My_Vector <- c("a" = 'a', "a" = 'b')
then,
> My_Vector['a']
a
"a"
I was expecting both elements should be shown up.
Is there any mechanism to force R do that?
Thanks and regards,
______________________________________________
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.