atorus-research / xportr

Tools to build CDISC compliant data sets and check for CDISC compliance.

Home Page:https://atorus-research.github.io/xportr/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: `xportr_df_label` sets `label` as "character(0)" when metadata does not have the right domain

vedhav opened this issue · comments

What happened?

I think we should have an unset "label" attribute when the metadata does not have the domain associated with it.

adsl <- data.frame(
  USUBJID = c(1001, 1002, 1003),
  SITEID = c(001, 002, 003),
  AGE = c(63, 35, 27),
  SEX = c("M", "F", "M")
)
metadata <- data.frame(
  dataset = c("adtte", "adae"),
  label = c("Time to Event Analysis", "Adverse Events Analysis")
)
# Note that the `domain` in the `xportr_df_label()` is automatically set to "adsl" because of the data name
adsl <- adsl |>
  xportr_df_label(metadata)
attr(adsl, "label")
# [1] "character(0)"

Duplicate of #180