> Name <- c("anu", "ashok", "kavin", "tharun")
> genderr <- c("F", "M", "M")
> Name[genderr == "M"]
[1] "ashok" "kavin"
The data Name
and genderr
are not connected using a data frame. But when I try to retrieve names of males, I’m able to retrieve the names. Is it internally connected?
I was expecting that the two objects must be connected using a data frame, to retrieve values of each other. But here i did not use any dataframe,still i’m able to retrieve. Are they internally connected
New contributor
Anu Ashok is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
You create
> genderr == "M"
[1] FALSE TRUE TRUE
> Name[c(FALSE, TRUE, TRUE)]
[1] "ashok" "kavin"