Skip to contents

Merges variables with corresponding case names from a data.frame with an scdf file

Usage

add_l2(scdf, data_l2, cvar = "case")

Arguments

scdf

A single-case data frame. See scdf() to learn about this format.

data_l2

A level 2 dataset.

cvar

Character string with the name of the "case" variable in the L2 dataset (default is 'case').

Value

An scdf

Details

This function is mostly used in combination with the hplm() function.

See also

Examples

Leidig2018 |> add_l2(Leidig2018_l2)
#> #A single-case data frame with 35 cases
#> 
#>  1a1: mt academic_engagement classID weekday disruptive_behavior phase class
#>        1                   4      1a       3                   1     A    1a
#>        2                   1      1a       4                   1     A    1a
#>        3                   2      1a       5                   1     A    1a
#>        4                <NA>      1a       1                <NA>     A    1a
#>        5                   2      1a       2                   1     A    1a
#>        6                   3      1a       3                   1     A    1a
#>        7                   1      1a       4                   1     A    1a
#>        8                   1      1a       5                   2     A    1a
#>        9                   3      1a       1                   0     B    1a
#>       10                   4      1a       2                   0     B    1a
#>       11                   3      1a       3                   0     B    1a
#>       12                   4      1a       4                   1     B    1a
#>       13                   4      1a       5                   0     B    1a
#>       14                   4      1a       1                   0     B    1a
#>       15                   4      1a       2                   0     B    1a
#>  gender migration first_language_german SDQ_TOTAL SDQ_EXTERNALIZING
#>       0         0                     1        10                 9
#>       0         0                     1        10                 9
#>       0         0                     1        10                 9
#>       0         0                     1        10                 9
#>       0         0                     1        10                 9
#>       0         0                     1        10                 9
#>       0         0                     1        10                 9
#>       0         0                     1        10                 9
#>       0         0                     1        10                 9
#>       0         0                     1        10                 9
#>       0         0                     1        10                 9
#>       0         0                     1        10                 9
#>       0         0                     1        10                 9
#>       0         0                     1        10                 9
#>       0         0                     1        10                 9
#>  SDQ_INTERNALIZING ITRF_TOTAL ITRF_ACADEMIC ITRF_BEHAVIOR
#>                  1         11             7             4
#>                  1         11             7             4
#>                  1         11             7             4
#>                  1         11             7             4
#>                  1         11             7             4
#>                  1         11             7             4
#>                  1         11             7             4
#>                  1         11             7             4
#>                  1         11             7             4
#>                  1         11             7             4
#>                  1         11             7             4
#>                  1         11             7             4
#>                  1         11             7             4
#>                  1         11             7             4
#>                  1         11             7             4
#> # ... up to 93 more rows
#> #  34 more cases