From fce32496c1f29f6e56a03b3469a12811f9b2f7f4 Mon Sep 17 00:00:00 2001 From: Megan McNicol <43570769+SwiftySalmon@users.noreply.github.com> Date: Tue, 20 Aug 2024 11:25:08 +0100 Subject: [PATCH] Reduce dependencies (#984) * removing packages that I don't think get used anywhere. and removing references to fst and spss files * Update documentation * Update authors in description * [check-spelling] Update metadata Update for https://github.com/Public-Health-Scotland/source-linkage-files/actions/runs/10469297653/attempts/1 Accepted in https://github.com/Public-Health-Scotland/source-linkage-files/pull/984#issuecomment-2298498525 Signed-off-by: check-spelling-bot on-behalf-of: @check-spelling * [check-spelling] Update metadata Update for https://github.com/Public-Health-Scotland/source-linkage-files/actions/runs/10469690723/attempts/1https://github.com/Public-Health-Scotland/source-linkage-files/actions/runs/10469690723/attempts/1 Accepted in https://github.com/Public-Health-Scotland/source-linkage-files/pull/984#issuecomment-2298506158 Signed-off-by: check-spelling-bot on-behalf-of: @check-spelling --------- Signed-off-by: check-spelling-bot Co-authored-by: marjom02 Co-authored-by: SwiftySalmon Co-authored-by: Jennifer Thom Co-authored-by: Jennit07 <67372904+Jennit07@users.noreply.github.com> Co-authored-by: Jennit07 --- .github/actions/spelling/expect.txt | 30 +++++++++++++++++------------ DESCRIPTION | 12 +----------- R/read_file.R | 8 -------- man/read_file.Rd | 2 -- 4 files changed, 19 insertions(+), 33 deletions(-) diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index 4eb473f0f..1abb216ea 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -3,9 +3,10 @@ Accom Admissio admloc admtype -adpe +ADPE adtf alstr +anomymous arrivalmode arth atlassian @@ -20,12 +21,12 @@ bodyloc boxi CAK callr -canx +Canx carehome careinspectorate categorises cattend -ccyy +CCYY cdn cennum CEREBROVASC @@ -36,10 +37,11 @@ chpstart cij Classificat cmh -cnws +CNWs codecov -comhairle +Comhairle commhosp +communicty congen copd costinc @@ -53,6 +55,7 @@ customise cvd dataframe datamart +datas datazone datediff dateformat @@ -158,7 +161,7 @@ keytime kis knitr lcap -lcho +LCHO lgl linetype lintr @@ -168,9 +171,9 @@ ltd lubridate magrittr markdownguide -matern -mcbride -mcmahon +Matern +mcnicol +megan microsoft MIU MMMYY @@ -203,6 +206,7 @@ parkinsons patflow pattype PCEC +pcs PERTH PHIBCS phs @@ -215,13 +219,15 @@ PLICS popluation Posix postcodes -ppas +Postcodesio +PPAs prac praccode ptypes purrr quickstart rankdir +rbindlist rcmdcheck rdd rdname @@ -232,13 +238,13 @@ readr readxl reasonwait recid +recordlinkage refailure reflectoring refsource reftype relaint renviron -returnsthe rlang rmarkdown Rnw @@ -268,7 +274,7 @@ simd slf slfhelper smr -smra +SMRA smrtype sourcedev sparra diff --git a/DESCRIPTION b/DESCRIPTION index a25794864..28a8303ff 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -3,12 +3,8 @@ Title: Create the Source Linkage Files Version: 0.0.0.9000 Authors@R: c( person("Public Health Scotland", , , "phs.source@phs.scot", role = c("cre", "cph")), + person("Megan", "McNicol", , "megan.mcnicol2@phs.scot", role = "aut"), person("Jennifer", "Thom", , "jennifer.thom@phs.scot", role = "aut"), - person("James", "McMahon", , "james.mcmahon@phs.scot", role = "aut", - comment = c(ORCID = "0000-0002-5380-2029")), - person("Catherine", "Holland", , "catherine.holland@phs.scot", role = "aut", - comment = c(ORCID = "0000-0002-3259-5745")), - person("Bateman", "McBride", , "Bateman.Mcbride@phs.scot", role = "aut"), person("Zihao", "Li", , "zihao.li@phs.scot", role = "aut", comment = c(ORCID = "0000-0002-5178-2124")) ) @@ -25,25 +21,19 @@ Imports: data.table (>= 1.14.6), dbplyr (>= 2.3.1), dplyr (>= 1.1.1), - dtplyr (>= 1.3.0), fs (>= 1.6.1), - fst (>= 0.9.8), future (>= 1.33.0), future.callr (>= 0.8.1), - glue (>= 1.6.2), - haven (>= 2.5.2), hms (>= 1.1.0), janitor (>= 2.2.0), keyring (>= 1.3.0), lubridate (>= 1.9.2), magrittr (>= 2.0.3), odbc (>= 1.3.1), - openssl (>= 2.0.5), openxlsx (>= 4.2.5), phsmethods (>= 0.2.2), phsopendata (>= 0.0.1.0), purrr (>= 1.0.1), - qs (>= 0.25.5), R.utils (>= 2.12.2), readr (>= 2.1.0), rlang (>= 1.1.0), diff --git a/R/read_file.R b/R/read_file.R index be0a6fc65..022f4cc26 100644 --- a/R/read_file.R +++ b/R/read_file.R @@ -3,8 +3,6 @@ #' @description Read a file, the function chosen to read the file is dependant #' on the file path. #' * `.rds` uses [readr::read_rds()]. -#' * `.fst` uses [fst::read_fst()]. -#' * `.sav` and `.zsav` use [haven::read_spss()]. #' * `.csv` and `.gz` use [readr::read_csv()]. Note that this assumes any file #' ending with `.gz` is a zipped CSV which isn't necessarily true! #' * `.parquet` uses [arrow::read_parquet()]. @@ -19,9 +17,6 @@ read_file <- function(path, col_select = NULL, as_data_frame = TRUE, ...) { valid_extensions <- c( "rds", "rds.gz", - "fst", - "sav", - "zsav", "csv", "csv.gz", "parquet" @@ -60,9 +55,6 @@ read_file <- function(path, col_select = NULL, as_data_frame = TRUE, ...) { data <- switch(ext, "rds" = readr::read_rds(file = path), "rds.gz" = readr::read_rds(file = path), - "fst" = tibble::as_tibble(fst::read_fst(path = path)), - "sav" = haven::read_spss(file = path, ...), - "zsav" = haven::read_spss(file = path, ...), "csv" = readr::read_csv(file = path, ..., show_col_types = FALSE), "csv.gz" = readr::read_csv(file = path, ..., show_col_types = FALSE), "parquet" = arrow::read_parquet( diff --git a/man/read_file.Rd b/man/read_file.Rd index 1ef351342..d4d94e0df 100644 --- a/man/read_file.Rd +++ b/man/read_file.Rd @@ -27,8 +27,6 @@ Read a file, the function chosen to read the file is dependant on the file path. \itemize{ \item \code{.rds} uses \code{\link[readr:read_rds]{readr::read_rds()}}. -\item \code{.fst} uses \code{\link[fst:write_fst]{fst::read_fst()}}. -\item \code{.sav} and \code{.zsav} use \code{\link[haven:read_spss]{haven::read_spss()}}. \item \code{.csv} and \code{.gz} use \code{\link[readr:read_delim]{readr::read_csv()}}. Note that this assumes any file ending with \code{.gz} is a zipped CSV which isn't necessarily true! \item \code{.parquet} uses \code{\link[arrow:read_parquet]{arrow::read_parquet()}}.