I have a very simple dataset and I tried to execute table () on the first column of the table, but R returns an error header message. I searched on the Internet, but I donβt quite understand why this will happen, since R takes my table as a table ... can anyone advise?
My expected result:
> table(tab$V1) CA 1 CO 1 OH 2
However, it returns:
> tabraw V1 V2 1 OH Cleveland 2 OH Columbus 3 CO Denver 4 CA SanFran > tab <- table(tabraw) > tab V2 V1 Cleveland Columbus Denver SanFran CA 0 0 0 1 CO 0 0 1 0 OH 1 1 0 0 > table(tab$V1) Error in tab$V1 : $ operator is invalid for atomic vectors
r
Kevin
source share