Skip to content

Allow to set datanames not identical with object names #210

Description

@pawelru
library(tern)
#> Loading required package: rtables
#> Loading required package: formatters
#> Loading required package: magrittr
#> 
#> Attaching package: 'rtables'
#> The following object is masked from 'package:utils':
#> 
#>     str
#> Registered S3 method overwritten by 'tern':
#>   method   from 
#>   tidy.glm broom
library(teal.data)
#> Loading required package: shiny
library(magrittr)

data <- cdisc_data() %>%
  within({
    adsl <- tern_ex_adsl %>%
      df_explicit_na()

    adtte <- tern_ex_adtte %>%
      df_explicit_na()
  })
datanames(data)
#> character(0)
datanames(data) <- c("ADSL", "ADTTE")
#> Error in `datanames<-`(`*tmp*`, value = c("ADSL", "ADTTE")): invalid name
data
#> <environment: 0x109b2c350> [L]
#> Parent: <environment: package:teal.data>
#> Bindings:
#> • adtte: <tibble[,28]> [L]
#> • adsl: <tibble[,21]> [L]

Created on 2023-12-04 with reprex v2.0.2

We probably need to enable a dict / named character vector as an argument as a new datanames.

Also - please enhance error message. We should return not match found type of thing instead.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions