wbarksdale wbarksdale - 1 year ago 71
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


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
and get the element in row 1 column 1?

42- 42-
Answer Source

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
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download