sat_score<-c(100,4,30,4,20)
state <-c("NC","NC","CA","WA","NC")
id <- 1: 5
data<-data.frame(sat_score,state,id)
data is like this
> data
sat_score state id
1 100 NC 1
2 4 NC 2
3 30 CA 3
4 4 WA 4
5 20 NC 5
if I want to see the state's frequency, I can use the following code,
data %>%
count(state)
and the result is like this
> data %>%
+ count(state)
state n
1 CA 1
2 NC 3
3 WA 1
However, what I want is not this frequency table for the whole "state" variable.
I want to have how many "NC" are in the "state" column
so, the results should be number 3.
How can I do this?