Skip to contents

Take a supertibble generated with read_redcap() and return one of its data tibbles.

Usage

extract_tibble(supertbl, tbl)

Arguments

supertbl

A supertibble generated by read_redcap(). Required.

tbl

The redcap_form_name of the data tibble to extract. Required.

Value

A tibble.

Details

This function makes it easy to extract a single instrument's data from a REDCapTidieR supertibble.

Examples

superheroes_supertbl
#> # A REDCapTidieR Supertibble with 2 instruments
#>   redcap_form_name   redcap_form_label  redcap_data redcap_metadata    structure
#>   <chr>              <chr>              <list>      <list>             <chr>    
#> 1 heroes_information Heroes Information <tibble>    <tibble [11 × 17]> nonrepea…
#> 2 super_hero_powers  Super Hero Powers  <tibble>    <tibble [2 × 17]>  repeating
#> # ℹ 4 more variables: data_rows <int>, data_cols <int>, data_size <lbstr_by>,
#> #   data_na_pct <formttbl>

extract_tibble(superheroes_supertbl, "heroes_information")
#> # A tibble: 734 × 12
#>    record_id name      gender eye_color race  hair_color height weight publisher
#>        <dbl> <chr>     <chr>  <chr>     <chr> <chr>       <dbl>  <dbl> <chr>    
#>  1         0 A-Bomb    Male   yellow    Human No Hair       203    441 Marvel C…
#>  2         1 Abe Sapi… Male   blue      Icth… No Hair       191     65 Dark Hor…
#>  3         2 Abin Sur  Male   blue      Unga… No Hair       185     90 DC Comics
#>  4         3 Abominat… Male   green     Huma… No Hair       203    441 Marvel C…
#>  5         4 Abraxas   Male   blue      Cosm… Black         -99    -99 Marvel C…
#>  6         5 Absorbin… Male   blue      Human No Hair       193    122 Marvel C…
#>  7         6 Adam Mon… Male   blue      -     Blond         -99    -99 NBC - He…
#>  8         7 Adam Str… Male   blue      Human Blond         185     88 DC Comics
#>  9         8 Agent 13  Female blue      -     Blond         173     61 Marvel C…
#> 10         9 Agent Bob Male   brown     Human Brown         178     81 Marvel C…
#> # ℹ 724 more rows
#> # ℹ 3 more variables: skin_color <chr>, alignment <chr>,
#> #   form_status_complete <fct>