0

When I use the table method, I get a count of how many of each element appears. e.g.

tab = table(data.frame(c('a','a','b','c')))

Gives me the value:

a b c 
2 1 1 

I don't understand what this data structure is though or how to use it. If I want to grab a value from it, I can use tab['a'], but this gives:

a 
2

When I check the type of tab['a'], it just tells me it's an integer. Why does it have the a attached to it? How do I get just the value (2)?

Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214
Kewl
  • 3,327
  • 5
  • 26
  • 45

0 Answers0