library(sate)
example_n <- 100
example <- data.frame(Race = sample(x=c("Black or African American", "Other"),
size=example_n, replace=TRUE),
Education = sample(x=c("Bachelor's degree (for example: BA, AB, BS)",
"Other"), size=example_n, replace=TRUE),
Household.Income = sample(x=c("$70,000-$79,999", "Other"),
size=example_n, replace=TRUE),
Age = sample(x=18:80, size=example_n, replace=TRUE),
Gender = sample(x=c("Woman", "Man", "Prefer not to say"),
size=example_n, replace=TRUE),
Ethnicity = sample(x=c("No, not of Hispanic, Latino, or Spanish origin",
"Other"), size=example_n, replace=TRUE),
ParticipantId = 1:example_n)
respondents.encoded <- encode.cloud.respondent.variables(dataset=example)
pop.targets <- target.population.demographics(state="FL")
respondents.weighted <- weights_for_population(respondentdata = respondents.encoded,
targetdata = pop.targets)
Run the code above in your browser using DataLab