wbarksdale wbarksdale - 2 months ago 7
R Question

How to access single elements in a table in R

How do I grab elements from a table in R.

My Data looks like this:

V1 V2
1 12.448 13.919
2 22.242 4.606
3 24.509 0.176


etc...

I basically just want to grab elements individually. I'm getting confused with all the R terminology like vectors, and I just want to be able to get at the individual elements.

Is there a function where I can just do like
data[v1][1]
and get the element in row 1 column 1?

42- 42-
Answer

That is so basic that I am wondering what book you are using to study: Try

data[1, "V1"]  # row first, quoted column name second, and case does matter
Comments