
The as.data.frame function transposes an scdf into one long data frame. Additionally, a data frame can be merged that includes level 2 data of the subjects. This might be helpful to prepare data to be used with other packages than scan.
# S3 method for scdf
as.data.frame(x, ..., l2 = NULL, id = "case")longSCDF(...)
An scdf object
Not implemented
A data frame providing additional variables at Level 2. The scdf has to have names for all cases and the Level 2 data frame has to have a column with corresponding case names.
Variable name of the Level 2 data frame that contains the case names.
Returns one data frame with data of all single-cases structured by the case variable.
Other data manipulation functions:
fill_missing()
,
outlier()
,
ranks()
,
shift()
,
smooth_cases()
,
standardize()
,
truncate_phase()
# NOT RUN {
## Convert the list of three single-case data frames from Grosche (2011) into one long data frame
Grosche2011
Grosche2011_long <- as.data.frame(Grosche2011)
Grosche2011_long
## Combine an scdf with data for l2
Leidig2018_long <- as.data.frame(Leidig2018, l2 = Leidig2018_l2)
names(Leidig2018_long)
summary(Leidig2018_long)
# }
Run the code above in your browser using DataLab