diff --git a/.Rbuildignore b/.Rbuildignore index c60b96b..b174fbc 100755 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -10,3 +10,5 @@ ^_pkgdown\.yml$ ^docs$ ^pkgdown$ +^CRAN-SUBMISSION$ +^\.github$ diff --git a/DESCRIPTION b/DESCRIPTION index 94f6d1c..30231c5 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: crimedata Title: Access Crime Data from the Open Crime Database -Version: 0.3.0 +Version: 0.3.1 Authors@R: person("Matthew", "Ashby", email = "matthew.ashby@ucl.ac.uk", - role = c("aut", "cre"), + role = c("aut", "cre", "cph"), comment = c(ORCID = "")) Description: Gives convenient access to publicly available police-recorded open crime data from large cities in the United States that are included in the diff --git a/NEWS.md b/NEWS.md index 32c5b64..74d1d78 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# crimedata 0.3.1 + +* Fixed an error with downloading some data for 2020 that was caused by a + change in the OSF API used to query the data. + + # crimedata 0.3.0 * Errors, warnings and messages are now generated using `rlang` to make them diff --git a/R/data.R b/R/data.R index 126607a..ce6a28e 100755 --- a/R/data.R +++ b/R/data.R @@ -4,7 +4,7 @@ #' obtained from the \href{https://osf.io/zyaqn/}{Crime Open Database}. #' #' More details of the data format are available on the -#' \href{https://osf.io/zyaqn/wiki/}{Crime Open Database website}. +#' \href{https://osf.io/zyaqn/wiki/home/}{Crime Open Database website}. #' Variables marked * are only available for some of the #' data, due to limitations in the data published by some cities. #' @@ -43,7 +43,7 @@ #' \href{https://osf.io/zyaqn/}{Crime Open Database}. #' #' More details of the data format are available on the -#' \href{https://osf.io/zyaqn/wiki/}{Crime Open Database website}. +#' \href{https://osf.io/zyaqn/wiki/home/}{Crime Open Database website}. #' Variables marked * are only available for some of the #' data, due to limitations in the data published by some cities. #' diff --git a/R/get_crime_data.R b/R/get_crime_data.R index 21878cb..a1ab4bc 100755 --- a/R/get_crime_data.R +++ b/R/get_crime_data.R @@ -266,7 +266,7 @@ get_crime_data <- function( crime_data, dplyr::vars(dplyr::one_of(c( "city_name", "offense_code", "offense_type", "offense_group", - "offense_against", "location_type", "location_category" + "offense_against" ))), as.factor ) @@ -275,14 +275,22 @@ get_crime_data <- function( dplyr::vars("date_single"), as.POSIXct, format = "%Y-%m-%d %H:%M" ) + if ( + "location_type" %in% names(crime_data) | + "location_category" %in% names(crime_data) + ) { + crime_data <- dplyr::mutate_at( + crime_data, + dplyr::vars(dplyr::one_of(c("location_type", "location_category"))), + as.factor + ) + } if ("date_start" %in% names(crime_data) | "date_end" %in% names(crime_data)) { - crime_data <- dplyr::mutate_at( crime_data, dplyr::vars(dplyr::one_of(c("date_start", "date_end"))), as.POSIXct, format = "%Y-%m-%d %H:%M" ) - } # return data diff --git a/cran-comments.md b/cran-comments.md index aadd4dd..81ed188 100755 --- a/cran-comments.md +++ b/cran-comments.md @@ -6,7 +6,8 @@ New submission Package was archived on CRAN -* This package was archived due to an out-of-date maintainer email address, - which I have now fixed. +* This package was archived due to an out-of-date maintainer email address and + a problem with one of the tests of `get_crime_data()`. Both these issues have + been fixed. * win-builder gives an 'Invalid DOI' message for the DOI https://doi.org/10.1163/24523666-00401007 but this DOI is valid. diff --git a/docs/404.html b/docs/404.html index 13675d3..41649dd 100644 --- a/docs/404.html +++ b/docs/404.html @@ -24,7 +24,7 @@ crimedata - 0.3.0 + 0.3.1