Skip to contents

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

Usage

orivisit(
  df_visit,
  call = NULL,
  env = parent.frame(),
  event_names = c("event"),
  col_names = list(study_id = "study_id", site_id = "site_id", patient_id = "patient_id",
    visit = "visit")
)

Arguments

df_visit

Data frame with columns: study_id, site_number, patnum, visit, n_ae.

call

optional, provide call, Default: NULL

env

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

event_names

vector, contains the event names, default = "event"

col_names

named list, indicate study_id, site_id, patient_id and visit column in df_visit input dataframe. Default: list( study_id = "study_id", site_id = "site_id", patient_id = "patient_id", visit = "visit" )

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,
  ratio_out = 0.4,
  factor_event_rate = - 0.6
)#'

visit <- orivisit(df_visit)

object.size(df_visit)
#> 131576 bytes
object.size(visit)
#> 3544 bytes

as.data.frame(visit)
#> # A tibble: 1,932 × 9
#>    patient_id site_id is_out max_visit_mean max_visit_sd event_per_visit_mean
#>    <chr>      <chr>   <lgl>           <dbl>        <dbl>                <dbl>
#>  1 P000001    S0001   TRUE               20            4                0.141
#>  2 P000001    S0001   TRUE               20            4                0.141
#>  3 P000001    S0001   TRUE               20            4                0.141
#>  4 P000001    S0001   TRUE               20            4                0.141
#>  5 P000001    S0001   TRUE               20            4                0.141
#>  6 P000001    S0001   TRUE               20            4                0.141
#>  7 P000001    S0001   TRUE               20            4                0.141
#>  8 P000001    S0001   TRUE               20            4                0.141
#>  9 P000001    S0001   TRUE               20            4                0.141
#> 10 P000001    S0001   TRUE               20            4                0.141
#> # ℹ 1,922 more rows
#> # ℹ 3 more variables: visit <int>, n_event <dbl>, study_id <chr>