Skip to contents

This is like a grouped data frame but with 3 grouping dimensions. These are labelled z, y, and x and relate to as z (i.e. group, or cohort), y (i.e. subgroup, or response) and x (i.e. data). In some configurations, only z and x are non-empty. The purpose of this is to make some group / subgroup data operations consistent. An example is running multiple models across different bootstraps from example.

Usage

as.var_grp_df(df, z, y, x)

Arguments

df

a dataframe

z

the z columns (e.g. cohort) as a list of columns

y

the y columns (e.g. response) as a list of columns

x

the x columns (e.g. predictor) as a list of columns

Examples

tmp = as.var_grp_df(iris, 
  c("Species"), 
  c("Sepal.Width", "Sepal.Length"), 
  c("Petal.Width", "Petal.Length"))
# print.var_grp_df(tmp)
glimpse.var_grp_df(tmp)
#> 3 group(s): Species.
#> (subgroup) Sepal.Width + Sepal.Length ~ Petal.Width + Petal.Length (data) 
#> Rows: 150
#> Columns: 5
#> $ Sepal.Length <dbl> 5.1, 4.9, 4.7, 4.6, 5.0, 5.4, 4.6, 5.0, 4.4, 4.9, 5.4, 4.…
#> $ Sepal.Width  <dbl> 3.5, 3.0, 3.2, 3.1, 3.6, 3.9, 3.4, 3.4, 2.9, 3.1, 3.7, 3.…
#> $ Petal.Length <dbl> 1.4, 1.4, 1.3, 1.5, 1.4, 1.7, 1.4, 1.5, 1.4, 1.5, 1.5, 1.…
#> $ Petal.Width  <dbl> 0.2, 0.2, 0.2, 0.2, 0.2, 0.4, 0.3, 0.2, 0.2, 0.1, 0.2, 0.…
#> $ Species      <fct> setosa, setosa, setosa, setosa, setosa, setosa, setosa, s…