Skip to content

Commit

Permalink
Updates to man for try() in CRAN failures
Browse files Browse the repository at this point in the history
  • Loading branch information
1beb committed Jun 20, 2022
1 parent f28e61b commit ac20b26
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 28 deletions.
4 changes: 2 additions & 2 deletions R/get_census_api_2.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#' If unsuccessful, function prints the URL query that was constructed.
#'
#' @examples
#' \dontrun{get_census_api_2(data_url = "https://api.census.gov/data/2010/dec/sf1?", key = "...",
#' get = c("P005003","P005004","P005005", "P005006"), region = "for=county:*&in=state:34")}
#' \dontrun{try(get_census_api_2(data_url = "https://api.census.gov/data/2010/dec/sf1?", key = "...",
#' get = c("P005003","P005004","P005005", "P005006"), region = "for=county:*&in=state:34"))}
#'
#' @references
#' Based on code authored by Nicholas Nagle, which is available
Expand Down
2 changes: 1 addition & 1 deletion R/merge_names.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
#' @importFrom dplyr coalesce
#' @examples
#' data(voters)
#' \dontrun{merge_names(voters, namesToUse = "surname", census.surname = TRUE)}
#' \dontrun{try(merge_names(voters, namesToUse = "surname", census.surname = TRUE))}
#' @keywords internal
merge_names <- function(voter.file, namesToUse, census.surname, table.surnames = NULL, table.first = NULL, table.middle = NULL, clean.names = TRUE, impute.missing = FALSE, model = "BISG") {

Expand Down
2 changes: 1 addition & 1 deletion R/merge_surnames.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
#'#'
#' @examples
#' data(voters)
#' \dontrun{merge_surnames(voters)}
#' \dontrun{try(merge_surnames(voters))}
#'
#' @keywords internal

Expand Down
22 changes: 13 additions & 9 deletions R/predict_race.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,24 +107,28 @@
#'
#' @examples
#' data(voters)
#' predict_race(voter.file = voters, surname.only = TRUE)
#' try(predict_race(voter.file = voters, surname.only = TRUE))
#' \dontrun{
#' predict_race(voter.file = voters, census.geo = "tract", census.key = "...")
#' try(predict_race(voter.file = voters, census.geo = "tract", census.key = "..."))
#' }
#' \dontrun{
#' predict_race(voter.file = voters, census.geo = "place", census.key = "...", year = "2020")
#' try(predict_race(
#' voter.file = voters, census.geo = "place", census.key = "...", year = "2020"))
#' }
#' \dontrun{
#' CensusObj <- get_census_data("...", state = c("NY", "DC", "NJ"))
#' predict_race(voter.file = voters, census.geo = "tract", census.data = CensusObj, party = "PID")
#' CensusObj <- try(get_census_data("...", state = c("NY", "DC", "NJ")))
#' try(predict_race(
#' voter.file = voters, census.geo = "tract", census.data = CensusObj, party = "PID")
#' )
#' }
#' \dontrun{
#' CensusObj2 <- get_census_data(key = "...", state = c("NY", "DC", "NJ"), age = T, sex = T)
#' predict_race(voter.file = voters, census.geo = "tract", census.data = CensusObj2, age = T, sex = T)
#' CensusObj2 <- try(get_census_data(key = "...", state = c("NY", "DC", "NJ"), age = T, sex = T))
#' try(predict_race(
#' voter.file = voters, census.geo = "tract", census.data = CensusObj2, age = T, sex = T))
#' }
#' \dontrun{
#' CensusObj3 <- get_census_data(key = "...", state = c("NY", "DC", "NJ"), census.geo = "place")
#' predict_race(voter.file = voters, census.geo = "place", census.data = CensusObj3)
#' CensusObj3 <- try(get_census_data(key = "...", state = c("NY", "DC", "NJ"), census.geo = "place"))
#' try(predict_race(voter.file = voters, census.geo = "place", census.data = CensusObj3))
#' }
#' @export

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ predict_race(voter.file = voters.dc.nj, census.geo = "county", census.data = cen
predict_race(voter.file = voters.dc.nj, census.geo = "tract", census.data = census.dc.nj2, party = "PID", age = TRUE, sex = FALSE) # Pr(Race | Surname, Tract, Party)
```

Or you can also use the census_geo_api() to maually construct a census object. The example below creates a census object with county-level and tract-level data in DC and NJ, while avoiding downloading block-level data. Note that this function has the input parameter 'state' that requires a two-letter state abbreviation to proceed.
Or you can also use the census_geo_api() to manually construct a census object. The example below creates a census object with county-level and tract-level data in DC and NJ, while avoiding downloading block-level data. Note that this function has the input parameter 'state' that requires a two-letter state abbreviation to proceed.

``` r
censusObj2 = list()
Expand Down
2 changes: 1 addition & 1 deletion man/format_legacy_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/get_census_api_2.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/merge_names.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/merge_surnames.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions man/predict_race.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ac20b26

Please sign in to comment.