v = rep(c(1,2, 2, 2), 25)
unique(v)
returns what the unique values are, but not how many they are.> unique(v)
[1] 1 2
length(v[v==1])
[1] 25
length(v[v==2])
[1] 75
#<doesn't work right> length(v[v==unique(v)])
dummyData = rep(c(1,2, 2, 2), 25)
table(dummyData)
# dummyData
# 1 2
# 25 75
## or another presentation of the same data
as.data.frame(table(dummyData))
# dummyData Freq
# 1 1 25
# 2 2 75
library("dplyr")
data %>% group_by(factor1, factor2) %>% summarize(count=n())