Skip to content

Commit

Permalink
use minty ref #173 (#187)
Browse files Browse the repository at this point in the history
* experiment with minty

* minty is on CRAN
  • Loading branch information
chainsawriot committed May 22, 2024
1 parent 8f0a330 commit 7289c7d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: readODS
Type: Package
Title: Read and Write ODS Files
Version: 2.2.0.999
Version: 2.2.0.9999
Authors@R:
c(person("Gerrit-Jan", "Schutten", role = c("aut"), email = "phonixor@gmail.com"),
person("Chung-hong", "Chan", role = c("aut", "cre"), email = "chainsawtiney@gmail.com", comment = c(ORCID = "0000-0002-6232-7530")),
Expand All @@ -25,7 +25,7 @@ URL: https://docs.ropensci.org/readODS/, https://github.com/ropensci/readODS
BugReports: https://github.com/ropensci/readODS/issues
Imports:
cellranger,
readr (>= 1.2.1),
minty,
stringi,
tibble,
vctrs (>= 0.4.2),
Expand All @@ -40,7 +40,8 @@ Suggests:
covr,
knitr,
rmarkdown,
withr
withr,
readr (>= 1.2.1)
License: GPL-3
RoxygenNote: 7.2.3
Roxygen: list(markdown = TRUE)
Expand Down
13 changes: 1 addition & 12 deletions R/read_ods.R
Original file line number Diff line number Diff line change
Expand Up @@ -139,22 +139,11 @@
return(data.frame())
}

.type_convert <- function(df, col_types = NULL, verbose = TRUE, na = c("", "NA"), trim_ws = TRUE) {
if (verbose) {
res <- readr::type_convert(df = df, col_types, na = na)
} else {
suppressMessages({
res <- readr::type_convert(df = df, col_types, na = na, trim_ws = trim_ws)
})
}
return(res)
}

.handle_col_types <- function(res, col_types, verbose, na, trim_ws) {
if (isTRUE(is.na(col_types)) || nrow(res) == 0) {
return(res)
}
.type_convert(df = res, col_types = col_types, verbose = verbose, na = na, trim_ws = trim_ws)
minty::type_convert(df = res, col_types = col_types, verbose = verbose, na = na, trim_ws = trim_ws)
}

## standardise `sheet` parameter as a number, i.e. sheet_index
Expand Down

0 comments on commit 7289c7d

Please sign in to comment.