Skip to content

Commit

Permalink
Make non-tsv file import defunct
Browse files Browse the repository at this point in the history
  • Loading branch information
wkmor1 committed Aug 21, 2024
1 parent 8a1a935 commit 2140209
Show file tree
Hide file tree
Showing 15 changed files with 23 additions and 1,062 deletions.
2 changes: 0 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ Suggests:
DBI,
future,
knitr,
readODS,
readxl,
rmarkdown,
RSQLite,
testthat (>= 3.0.0),
Expand Down
15 changes: 1 addition & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ dev_deps:
> ${RSCRIPT} -e "stopifnot(requireNamespace('jsonlite', quietly = TRUE))";\
> ${RSCRIPT} -e "stopifnot(requireNamespace('knitr', quietly = TRUE))";\
> ${RSCRIPT} -e "stopifnot(requireNamespace('pkgdown', quietly = TRUE))";\
> ${RSCRIPT} -e "stopifnot(requireNamespace('readODS', quietly = TRUE))";\
> ${RSCRIPT} -e "stopifnot(requireNamespace('readxl', quietly = TRUE))";\
> ${RSCRIPT} -e "stopifnot(requireNamespace('rmarkdown', quietly = TRUE))";\
> ${RSCRIPT} -e "stopifnot(requireNamespace('RSQLite', quietly = TRUE))";\
> ${RSCRIPT} -e "stopifnot(requireNamespace('sf', quietly = TRUE))";\
Expand All @@ -51,7 +49,7 @@ sentinels/check: sentinels/pkgdown $(shell find tests -type f)
> mkdir -p $(@D);\
> touch $@

sentinels/pkgdown: sentinels/vignettes README.md NEWS.md LICENSE sentinels/doc _pkgdown.yml $(shell find pkgdown -type f)
sentinels/pkgdown: sentinels/vignettes README.md LICENSE sentinels/doc _pkgdown.yml $(shell find pkgdown -type f)
> echo "options(rmarkdown.html_vignette.check_title = FALSE)" > .Rprofile;\
> ${RSCRIPT} -e "pkgdown::build_site()";\
> rm .Rprofile; \
Expand All @@ -62,17 +60,6 @@ sentinels/pkgdown: sentinels/vignettes README.md NEWS.md LICENSE sentinels/doc _
README.md: README.Rmd DESCRIPTION
> ${RSCRIPT} -e "knitr::knit('$<')"

NEWS.md: inst/NEWS.Rd
> ${RSCRIPT} -e "tools::Rd2HTML('$<', 'inst/NEWS.html')";\
> sed -i 's/h2>/h1>/g' inst/NEWS.html;\
> sed -i 's/h3>/h1>/g' inst/NEWS.html;\
> sed -i 's/h4>/h2>/g' inst/NEWS.html;\
> pandoc -s inst/NEWS.html -o inst/NEWS.md -t gfm;\
> sed -i '1,8d' inst/NEWS.md;\
> head -n -2 inst/NEWS.md > NEWS.md;\
> sed -i 's/# ${PKGNM} version/# ${PKGNM}/g' NEWS.md;\
> $(RM) inst/NEWS.html inst/NEWS.md

sentinels/vignettes: $(shell find inst/vign -type f)
> cd ..;\
> R CMD build $(PKGSRC);\
Expand Down
5 changes: 3 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

# finbif 0.9.8.9000

## NEW FEATURES
## DEFUNCT

- This is the latest development version.
- Importing `.ods` and `.xlsx` occurrence data files is now defunct users
should use `.tsv` download files only.

# finbif 0.9.8

Expand Down
69 changes: 0 additions & 69 deletions R/finbif_occurrence_load.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,6 @@ finbif_occurrence_load <- function(
skip = 0
) {

nchars <- nchar(file)

file <- switch(
substring(file, nchars - 3L, nchars),
.ods = from_ods(file),
xlsx = from_xlsx(file),
file
)

fb_records_obj <- list(
file = file,
n = as.integer(n),
Expand Down Expand Up @@ -1583,66 +1574,6 @@ open_tsv_connection <- function(connection_obj) {

}

#' @noRd

from_ods <- function(file) {

warn <- Sys.getenv("DEPRECATION_WARNING", 0)

op <- options()

options(warn = as.integer(warn))

warning(
"Reading ODS file downloads has been deprecated in the {finbif} package ",
"and will unavailable in the next release. Please use TSV downloads ",
"instead.",
call. = FALSE
)

options(op)

stopifnot("Package {readODS} required for ODS files" = has_pkgs("readODS"))

df <- readODS::read_ods(file, col_types = NA)

write_tsv(df)

}

#' @noRd

from_xlsx <- function(file) {

warn <- Sys.getenv("DEPRECATION_WARNING", 0)

op <- options()

options(warn = as.integer(warn))

warning(
"Reading XLSX file downloads has been deprecated in the {finbif} package ",
"and will unavailable in the next release. Please use TSV downloads ",
"instead.",
call. = FALSE
)

options(op)

stopifnot("Package {readxl} required for Excel files" = has_pkgs("readxl"))

df <- readxl::read_xlsx(
file,
progress = FALSE,
col_types = "text",
trim_ws = FALSE,
.name_repair = "minimal"
)

write_tsv(df)

}

#' @noRd
#' @importFrom utils write.table

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ FinBIF itself and the contributed datasets please visit this link:
To cite the finbif R package in publications please use:

Morris, William K. (2024). Introduction to the finbif package. R
package version 0.9.8, https://doi.org/10.5281/zenodo.3612814
package version 0.9.8.9000, https://doi.org/10.5281/zenodo.3612814

----

Expand Down
26 changes: 1 addition & 25 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,30 +106,6 @@
},
"sameAs": "https://CRAN.R-project.org/package=knitr"
},
{
"@type": "SoftwareApplication",
"identifier": "readODS",
"name": "readODS",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=readODS"
},
{
"@type": "SoftwareApplication",
"identifier": "readxl",
"name": "readxl",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=readxl"
},
{
"@type": "SoftwareApplication",
"identifier": "rmarkdown",
Expand Down Expand Up @@ -246,7 +222,7 @@
"applicationCategory": "Biodiversity",
"isPartOf": "https://species.fi",
"keywords": ["api", "biodiversity", "biodiversity-informatics", "biodiversity-information", "finbif", "finbif-access", "occurrences", "r-package", "r-programming", "rstats", "species", "specimens", "taxon", "taxonomy", "web-services"],
"fileSize": "12047.358KB",
"fileSize": "11961.439KB",
"citation": [
{
"@type": "SoftwareSourceCode",
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html

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

6 changes: 3 additions & 3 deletions docs/news/index.html

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

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ articles:
v03_selecting_variables: v03_selecting_variables.html
v04_metadata: v04_metadata.html
v05_filtering: v05_filtering.html
last_built: 2024-08-19T10:30Z
last_built: 2024-08-21T08:56Z
urls:
reference: https://finbif-docs-dev.netlify.app/reference
article: https://finbif-docs-dev.netlify.app/articles
2 changes: 1 addition & 1 deletion docs/search.json

Large diffs are not rendered by default.

Loading

0 comments on commit 2140209

Please sign in to comment.