Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Add "hms" to xportr.numeric_types #271

Open
bundfussr opened this issue Jul 2, 2024 · 2 comments
Open

Feature Request: Add "hms" to xportr.numeric_types #271

bundfussr opened this issue Jul 2, 2024 · 2 comments
Labels
enhancement New feature or request programming

Comments

@bundfussr
Copy link
Collaborator

Feature Idea

I would suggest to add "hms" to the default value of xportr.numeric_types. Time variables which are created by admiral::derive_vars_dtm_to_tm() are of class "hms". Without adding "hms" xportr_type() considers time variable as converted.

Relevant Input

No response

Relevant Output

No response

Reproducible Example/Pseudo Code

library(xportr)
library(magrittr)
library(admiral)
metadata <- data.frame(
  dataset = "test",
  variable = c("ADTM", "ATM"),
  type = "numeric"
)

.df <- data.frame(
  ADTM = convert_dtc_to_dtm("2024-03-24T12:34:56")
) %>% derive_vars_dtm_to_tm(source_vars = exprs(ADTM))

df2 <- xportr_type(.df, metadata, "test", verbose = "warn")

produces


── Variable type mismatches found. ──

✔ 1 variables coerced
Warning message:
Variable type(s) in dataframe don't match metadata: `ATM`
@bundfussr bundfussr added enhancement New feature or request programming labels Jul 2, 2024
@bundfussr
Copy link
Collaborator Author

By the way, the message could be improved by stating which type was found in metadata and which in data. I had to read the code to find out what caused the warning.

@bms63
Copy link
Collaborator

bms63 commented Jul 5, 2024

@atorus-research/xportr-development-team anyone on the team want to make this update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request programming
Projects
None yet
Development

No branches or pull requests

2 participants