Skip to content

Commit

Permalink
force keytime format to hms (#77)
Browse files Browse the repository at this point in the history
* force keytime format to hms

* Update documentation

* visible binding for global variables like ‘keytime1’

* minor changes

* fix keytime in column names

* import hms

---------

Co-authored-by: lizihao-anu <lizihao-anu@users.noreply.github.com>
  • Loading branch information
lizihao-anu and lizihao-anu committed Mar 19, 2024
1 parent b5eab41 commit 18b6909
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Imports:
dplyr (>= 1.1.2),
fs (>= 1.6.2),
fst (>= 0.9.8),
hms,
lifecycle (>= 1.0.3),
magrittr (>= 2.0.3),
openssl (>= 2.0.6),
Expand Down Expand Up @@ -52,4 +53,4 @@ Language: en-GB
LazyData: true
Roxygen: list(markdown = TRUE, roclets = c("collate","namespace", "rd",
"vignette" ))
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
30 changes: 20 additions & 10 deletions R/read_slf.R
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,27 @@ read_slf_episode <- function(
}
# TODO add option to drop blank CHIs?
# TODO add a filter by recid option
return(
read_slf(
year = year,
col_select = unique(col_select),
file_version = "episode",
partnerships = unique(partnerships),
recids = unique(recids),
as_data_frame = as_data_frame,
dev = dev
)

data <- read_slf(
year = year,
col_select = unique(col_select),
file_version = "episode",
partnerships = unique(partnerships),
recids = unique(recids),
as_data_frame = as_data_frame,
dev = dev
)

if ("keytime1" %in% colnames(data)) {
data <- data %>%
dplyr::mutate(keytime1 = hms::as_hms(.data$keytime1))
}
if ("keytime2" %in% colnames(data)) {
data <- data %>%
dplyr::mutate(keytime2 = hms::as_hms(.data$keytime2))
}

return(data)
}

#' Read a Source Linkage individual file
Expand Down

0 comments on commit 18b6909

Please sign in to comment.