For demographic analysis of state I want to compare race and ethnicity and want to find out how many people are hispanic, non-hispanic and others

Hi priya53, I'd ask this kind of question with a minimal reprex. (FAQ: What's a reproducible example (`reprex`) and how do I do one?)

For the "find out how many people" question, check out dplyr's group_by + tally function. https://dplyr.tidyverse.org/reference/tally.html

For example,

# tally() is short-hand for summarise()
mtcars %>% tally()
#>    n
#> 1 32
mtcars %>% group_by(cyl) %>% tally()
#> # A tibble: 3 x 2
#>     cyl     n
#>   <dbl> <int>
#> 1     4    11
#> 2     6     7
#> 3     8    14
# count() is a short-hand for group_by() + tally()

mtcars %>% group_by(cyl) %>% tally() gives you how many observations mtcars has for each unique value of cyl.