There are more sophisticated ways but at its most basic
dat1 <- data.frame(A = sample(c("John", "Shawn", "Todd", "Mike"), 20, replace = TRUE),
B = rnorm(20, mean = 10, sd = 3))
table(dat1$A)
To get the table output into a vector that is easier to use
dat2 <- as.vector(table(dat1$A))