Skip to contents

Internal S3 object, stores lazy reference to original visit data.

Usage

orivisit(df_visit, call = NULL, env = parent.frame())

Arguments

df_visit

dataframe with original visit data

call

optional, provide call, Default: NULL

env

optional, provide environment of original visit data, Default: parent.frame()

Value

orivisit object

Details

Saves variable name of original visit data, checks whether it can be retrieved from parent environment and stores summary. Original data can be retrieved using as.data.frame(x).

Examples


df_visit <- sim_test_data_study(
  n_pat = 100,
  n_sites = 5,
  frac_site_with_ur = 0.4,
  ur_rate = 0.6
)

df_visit$study_id <- "A"

visit <- orivisit(df_visit)

object.size(df_visit)
#> 125288 bytes
object.size(visit)
#> 2288 bytes

as.data.frame(visit)
#> # A tibble: 1,956 × 9
#>    patnum  site_number is_ur max_visit_mean max_visit_sd ae_per_visit_mean visit
#>    <chr>   <chr>       <lgl>          <dbl>        <dbl>             <dbl> <int>
#>  1 P000001 S0001       TRUE              20            4               0.2     1
#>  2 P000001 S0001       TRUE              20            4               0.2     2
#>  3 P000001 S0001       TRUE              20            4               0.2     3
#>  4 P000001 S0001       TRUE              20            4               0.2     4
#>  5 P000001 S0001       TRUE              20            4               0.2     5
#>  6 P000001 S0001       TRUE              20            4               0.2     6
#>  7 P000001 S0001       TRUE              20            4               0.2     7
#>  8 P000001 S0001       TRUE              20            4               0.2     8
#>  9 P000001 S0001       TRUE              20            4               0.2     9
#> 10 P000001 S0001       TRUE              20            4               0.2    10
#> # ℹ 1,946 more rows
#> # ℹ 2 more variables: n_ae <int>, study_id <chr>