Skip to content

Commit

Permalink
refactor: replace writexl w/ openxlsx in write_sf_ext
Browse files Browse the repository at this point in the history
  • Loading branch information
elipousson committed Jul 26, 2022
1 parent bce07b6 commit 09b1e1e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ Suggests:
knitr,
lwgeom,
naniar,
openxlsx,
rappdirs,
readr,
readxl,
rmarkdown,
testthat (>= 3.0.0),
tidygeocoder,
writexl
tidygeocoder
VignetteBuilder:
knitr
Remotes:
elipousson/esri2sf
Config/testthat/edition: 3
Expand All @@ -54,4 +56,3 @@ Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.0.9000
VignetteBuilder: knitr
6 changes: 3 additions & 3 deletions R/write_sf_ext.R
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ write_sf_types <- function(data,
if (type %in% c("sf_csv", "df_csv", "rda")) {
is_pkg_installed("readr")
} else if (type %in% c("sf_excel", "df_excel")) {
is_pkg_installed("writexl")
is_pkg_installed("openxlsx")
path <- str_add_filetype(path, "xlsx")
}

Expand All @@ -366,11 +366,11 @@ write_sf_types <- function(data,

switch(type,
"sf_csv" = readr::write_csv(x = data, file = path),
"sf_excel" = writexl::write_xlsx(data, path = path),
"sf_excel" = openxlsx::write.xlsx(data, fiile = path),
"sf_gsheet" = write_sf_gsheet(data = data, filename = filename, ...),
"sf_spatial" = sf::write_sf(obj = data, dsn = path, ...),
"df_csv" = readr::write_csv(x = data, file = path),
"df_excel" = writexl::write_xlsx(data, path = path),
"df_excel" = openxlsx::write.xlsx(data, fiile = path),
"rda" = readr::write_rds(x = data, file = path, ...)
)
}
Expand Down
26 changes: 13 additions & 13 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,18 @@
},
"sameAs": "https://CRAN.R-project.org/package=naniar"
},
{
"@type": "SoftwareApplication",
"identifier": "openxlsx",
"name": "openxlsx",
"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=openxlsx"
},
{
"@type": "SoftwareApplication",
"identifier": "rappdirs",
Expand Down Expand Up @@ -242,18 +254,6 @@
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=tidygeocoder"
},
{
"@type": "SoftwareApplication",
"identifier": "writexl",
"name": "writexl",
"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=writexl"
}
],
"softwareRequirements": {
Expand Down Expand Up @@ -397,7 +397,7 @@
},
"SystemRequirements": null
},
"fileSize": "659.773KB",
"fileSize": "437.682KB",
"readme": "https://github.com/elipousson/sfext/blob/main/README.md",
"contIntegration": "https://app.codecov.io/gh/elipousson/sfext?branch=main",
"developmentStatus": ["https://lifecycle.r-lib.org/articles/stages.html#experimental", "https://www.repostatus.org/#active"],
Expand Down

0 comments on commit 09b1e1e

Please sign in to comment.