These functions modify the input data frame prior to passing it to
stable()
or stable_long()
.
st_select(x, ...)
st_mutate(x, ...)
st_filter(x, ...)
an stobject.
passed to dplyr::select()
, dplyr::mutate()
, or
dplyr::filter()
.
st_select
calls dplyr::select
on the data
st_mutate
calls dplyr::mutate
on the data
st_filter
calls dplyr::filter
on the data
tab <- pt_data_inventory(pmt_obs, by = "FORM")
obj <- st_new(tab)
st_filter(obj, FORM != "troche")
#> # A tibble: 3 × 7
#> FORM Number.SUBJ Number.MISS Number.OBS Number.BQL Percent.OBS Percent.BQL
#> <chr> <int> <int> <int> <int> <chr> <chr>
#> 1 "capsul… 15 3 317 10 9.1 0.3
#> 2 "tablet" 130 43 2730 77 78.4 2.2
#> 3 "\\hlin… 160 50 3386 94 97.3 2.7
st_select(obj, -contains("BQL"))
#> # A tibble: 3 × 5
#> FORM Number.SUBJ Number.MISS Number.OBS Percent.OBS
#> <chr> <int> <int> <int> <chr>
#> 1 "capsule" 15 3 317 9.1
#> 2 "tablet" 130 43 2730 78.4
#> 3 "\\hline \\hline {\\bf All dat… 160 50 3386 97.3
st_mutate(obj, FORM = ifelse(FORM=="tablet", "ODT", FORM))
#> # A tibble: 3 × 5
#> FORM Number.SUBJ Number.MISS Number.OBS Percent.OBS
#> <chr> <int> <int> <int> <chr>
#> 1 "capsule" 15 3 317 9.1
#> 2 "ODT" 130 43 2730 78.4
#> 3 "\\hline \\hline {\\bf All dat… 160 50 3386 97.3