diff --git a/R/get_census_api_2.R b/R/get_census_api_2.R index 6c9aa08..92e61bb 100644 --- a/R/get_census_api_2.R +++ b/R/get_census_api_2.R @@ -6,8 +6,8 @@ #' It is used by the \code{get_census_api} function. The user should not need to call this #' function directly. #' -#' @param data_url URL root of the API, including the question mark, -#' e.g., \code{"api.census.gov/data/2020/dec/dhc"}. +#' @param data_url URL root of the API, +#' e.g., \code{"https://api.census.gov/data/2020/dec/dhc"}. #' @param key A required character object containing user's Census API key, #' which can be requested \href{https://api.census.gov/data/key_signup.html}{here}. #' @param get A character vector of variables to get, diff --git a/R/merge_surnames.R b/R/merge_surnames.R index f7c6cd4..ef8b4f5 100644 --- a/R/merge_surnames.R +++ b/R/merge_surnames.R @@ -27,7 +27,7 @@ #' named 'surname' containing list of surnames to be merged with Census lists. #' @param surname.year An object of class \code{numeric} indicating which year #' Census Surname List is from. Accepted values are \code{2010} and \code{2000}. -#' Default is \code{2010}. +#' Default is \code{2020}. #' @param name.data An object of class \code{data.frame}. Must contain a leading #' column of surnames, and 5 subsequent columns, with Pr(Race | Surname) for each #' of the five major racial categories. @@ -54,7 +54,7 @@ #' #' @keywords internal -merge_surnames <- function(voter.file, surname.year = 2010, name.data, clean.surname = TRUE, impute.missing = TRUE) { +merge_surnames <- function(voter.file, surname.year = 2020, name.data, clean.surname = TRUE, impute.missing = TRUE) { if ("surname" %in% names(voter.file) == FALSE) { stop('Data does not contain surname field.') diff --git a/R/predict_race.R b/R/predict_race.R index 92ffa21..8457a6b 100644 --- a/R/predict_race.R +++ b/R/predict_race.R @@ -64,7 +64,7 @@ #' If \code{TRUE}, \code{\var{voter.file}} should include a numerical variable \code{\var{sex}}, #' where \code{\var{sex}} is coded as 0 for males and 1 for females. #' @param year An optional character vector specifying the year of U.S. Census geographic -#' data to be downloaded. Use \code{"2010"}, or \code{"2020"}. Default is \code{"2010"}. +#' data to be downloaded. Use \code{"2010"}, or \code{"2020"}. Default is \code{"2020"}. #' @param party An optional character object specifying party registration field #' in \code{\var{voter.file}}, e.g., \code{\var{party} = "PartyReg"}. #' If specified, race/ethnicity predictions will be conditioned @@ -136,7 +136,7 @@ #' @export predict_race <- function(voter.file, census.surname = TRUE, surname.only = FALSE, - surname.year = 2010, census.geo, census.key = NULL, census.data = NULL, age = FALSE, + surname.year = 2020, census.geo, census.key = NULL, census.data = NULL, age = FALSE, sex = FALSE, year = "2020", party = NULL, retry = 3, impute.missing = TRUE, use.counties = FALSE, model = "BISG", race.init = NULL, name.dictionaries = NULL, names.to.use = "surname", control = NULL) { diff --git a/R/race_prediction_funs.R b/R/race_prediction_funs.R index ef000f0..1ade9c7 100644 --- a/R/race_prediction_funs.R +++ b/R/race_prediction_funs.R @@ -46,7 +46,7 @@ NULL #' @keywords internal .predict_race_old <- function(voter.file, - census.surname = TRUE, surname.only = FALSE, surname.year = 2010, name.dictionaries = NULL, + census.surname = TRUE, surname.only = FALSE, surname.year = 2020, name.dictionaries = NULL, census.geo, census.key, census.data = NULL, age = FALSE, sex = FALSE, year = "2020", party, retry = 3, impute.missing = TRUE, use.counties = FALSE) { @@ -101,7 +101,7 @@ NULL ## Merge in Pr(Race | Surname) if necessary if (census.surname) { if (!(surname.year %in% c(2000, 2010, 2020))) { - stop(paste(surname.year, "is not a valid surname.year. It should be 2000, 2010 (default) or 2020.")) + stop(paste(surname.year, "is not a valid surname.year. It should be 2000, 2010 or 2020 (default).")) } voter.file <- merge_surnames(voter.file, surname.year = surname.year, name.data = NULL, impute.missing = impute.missing) } else { @@ -268,7 +268,7 @@ predict_race_new <- function(voter.file, names.to.use, year = "2020",age = FALSE # Check years if (!(year %in% c("2000", "2010", "2020"))){ - stop("Year should be one of 2000, 2010, or 2020.") + stop("Year should be one of 2000, 2010, or 2020 (default).") } # Define 2020 race marginal race.margin <- c(r_whi=0.5783619, r_bla=0.1205021, r_his=0.1872988,