Hello!
I am trying to generate a table using the data table (can be generated using the code below). I need to be able to group the data to show me the number of people in each state for each raceethk who have taken each test (for example: in alabama, how many people of each raceethk category have taken test P_u12CRV, have not taken test P_u12CRV, and NA. How many people of each raceethk category have taken test P_UTDHEP, have not taken test P_UTDHEP, and NA, and so on for each test all in one table). I know that tidyverse can be used through the groupby function to do generate a different table for each test column individually, but I am not sure how to generate one large table for all of the tests. I appreciate any and all help!
Here is the code to use to generate the data: structure(list(SEQNUMC = structure(c("152651", "12631", "261061", "102261", "269631", "247001", "262721", "217211", "191371", "170311", "152311", "110191", "162801", "54921", "104221", "48621"), label = "UNIQUE CHILD IDENTIFIER", class = c("labelled", "character")), PDAT = structure(c(1L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 1L, 2L), .Label = c("CHILD HAS ADEQUATE PROVIDER DATA OR ZERO VACCINATIONS", "CHILD DOES NOT HAVE ADEQUATE PROVIDER DATA"), class = "factor"), RACEETHK = structure(c(1L, 2L, 1L, 4L, 1L, 1L, 2L, 2L, 2L, 2L, 4L, 4L, 1L, 2L, 1L, 2L), .Label = c("HISPANIC", "NON-HISPANIC WHITE ONLY", "NON-HISPANIC BLACK ONLY", "NON-HISPANIC OTHER + MULTIPLE RACE"), class = "factor"), STATE = structure(c(40L, 18L, 47L, 49L, 4L, 36L, 18L, 16L, 45L, 18L, 14L, 16L, 4L, 42L, 7L, 1L), .Label = c("ALABAMA", "DELAWARE", "DISTRICT OF COLUMBIA", "FLORIDA", "GEORGIA", "HAWAII", "IDAHO", "ILLINOIS", "INDIANA", "IOWA", "ALASKA", "KANSAS", "KENTUCKY", "LOUISIANA", "MAINE", "MARYLAND", "MASSACHUSETTS", "MICHIGAN", "MINNESOTA", "MISSISSIPPI", "MISSOURI", "MONTANA", "NEBRASKA", "NEVADA", "NEW HAMPSHIRE", "NEW JERSEY", "NEW MEXICO", "NEW YORK", "NORTH CAROLINA", "NORTH DAKOTA", "OHIO", "ARIZONA", "OKLAHOMA", "OREGON", "PENNSYLVANIA", "RHODE ISLAND", "SOUTH CAROLINA", "SOUTH DAKOTA", "TENNESSEE", "TEXAS", "UTAH", "ARKANSAS", "VERMONT", "VIRGINIA", "WASHINGTON", "WEST VIRGINIA", "WISCONSIN", "WYOMING", "CALIFORNIA", "GUAM", "PUERTO RICO", "U.S. VIRGIN ISLANDS", "COLORADO", "CONNECTICUT"), class = "factor"), P_U12VRC = structure(c(2L, NA, 1L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 2L, NA, 2L, NA), .Label = c("NOT UTD", "UTD"), class = "factor"), P_UTDHEP = structure(c(2L, NA, 1L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 2L, NA, 2L, NA), .Label = c("NOT UTD", "UTD"), class = "factor"), P_UTDHEPA2 = structure(c(2L, NA, 1L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1L, NA, 2L, NA), .Label = c("NOT UTD", "UTD"), class = "factor")), row.names = c(NA, 16L), class = "data.frame")