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
  • 506,650
  • 124
  • 909
  • 1,183
Kewl
  • 3,157
  • 3
  • 23
  • 44

0 Answers0