Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
fix #39 fix non-ascii strings
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Jul 29, 2020
1 parent 7e3a614 commit 7b17141
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 2 deletions.
6 changes: 5 additions & 1 deletion R/mapr-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ NULL
#' Example dataset: output from call to [spocc::occ()]
#'
#' A dataset with 25 rows, and 62 columns, from the query:
#' `spocc::occ(query='Accipiter striatus', from='gbif', limit=25, has_coords=T)`
#' `occ(query='Accipiter striatus', from='gbif', limit=25, has_coords=TRUE)`
#'
#' See `inst/ignore/datasets.R` for the code to prepare this dataaset
#'
#' @docType data
#' @keywords datasets
Expand All @@ -50,6 +52,8 @@ NULL
#'
#' A dataset with 50 rows, and 101 columns, from the query:
#' `rgbif::occ_search(scientificName = "Puma concolor", limit = 100)`
#'
#' See `inst/ignore/datasets.R` for the code to prepare this dataaset
#'
#' @docType data
#' @keywords datasets
Expand Down
Binary file modified data/gbif_eg1.rda
Binary file not shown.
Binary file modified data/occdat_eg1.rda
Binary file not shown.
30 changes: 30 additions & 0 deletions inst/ignore/datasets.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## mapr datasets preparation script

# gbif_eg1
library(rgbif)
foo <- occ_search(scientificName = "Puma concolor", limit = 100)
z <- foo$data
for (i in seq_along(z)) {
if (is.character(z[[i]])) {
cat(names(z)[i], sep = "\n")
tools::showNonASCII(na.omit(z[[i]]))
}
}
foo$data$rightsHolder <- stringi::stri_escape_unicode(foo$data$rightsHolder)
foo$data$stateProvince <- stringi::stri_escape_unicode(foo$data$stateProvince)
foo$data$verbatimLocality <- stringi::stri_escape_unicode(foo$data$verbatimLocality)
foo$data$recordedBy <- stringi::stri_escape_unicode(foo$data$recordedBy)
foo$data$rights <- stringi::stri_escape_unicode(foo$data$rights)
foo$data$identifiedBy <- stringi::stri_escape_unicode(foo$data$identifiedBy)
foo$data$occurrenceRemarks <- stringi::stri_escape_unicode(foo$data$occurrenceRemarks)
z <- foo$data
gbif_eg1 <- foo$data
save(gbif_eg1, file = "data/gbif_eg1.rda", version = 2)

# occdat_eg1
library(spocc)
res <- occ(query='Accipiter striatus', from='gbif', limit=25, has_coords=TRUE)
res$gbif$data[[1]]$rights <- stringi::stri_escape_unicode(res$gbif$data[[1]]$rights)
tools::showNonASCII(res$gbif$data[[1]]$rights)
occdat_eg1 <- res
save(occdat_eg1, file = "data/occdat_eg1.rda", version = 2)
3 changes: 3 additions & 0 deletions man/gbif_eg1.Rd

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

5 changes: 4 additions & 1 deletion man/occdat_eg1.Rd

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

0 comments on commit 7b17141

Please sign in to comment.