I have a dataframe of 1000s of row and columns..
I need to find a particular row, by means of its rowname (so I know the rowname, but do not know which position it is in).. so for example
V1 V2 V3 V4
sunny 23 78 56 56
vicky 89 89 22 11
nikki 09 76 99 27
suchi 00 88 38 09
kitty 89 02 89 90
So in a huge while (like above), lets say, i need to find and extract the row which has the row name "nikki", so my result should be
V1 V2 V3 V4
nikki 09 76 99 27
I know it might be simple, but can anyone help me know how to achieve that? Thanks in advance..
To subset a data frame by row names, you can just use a character string or vector as row indexing to the [
operator :
df["nikki",]
Or :
df[c("nikki","sunny"),]