get_data: Get data from objects generated by tidyLPA

View source: R/estimate-profiles.R

get_dataR Documentation

Get data from objects generated by tidyLPA

Description

Get data from objects generated by tidyLPA.

Usage

get_data(x, ...)

## S3 method for class 'tidyLPA'
get_data(x, ...)

## S3 method for class 'tidyProfile'
get_data(x, ...)

Arguments

x

An object generated by tidyLPA.

...

further arguments to be passed to or from other methods. They are ignored in this function.

Value

If one model is fit, the data is returned in wide format as a tibble. If more than one model is fit, the data is returned in long form. See the examples.

Methods (by class)

  • get_data(tidyLPA): Get data for a latent profile analysis with multiple numbers of classes and models, of class 'tidyLPA'.

  • get_data(tidyProfile): Get data for a single latent profile analysis object, of class 'tidyProfile'.

Author(s)

Caspar J. van Lissa

Examples

## Not run: 
if(interactive()){
 library(dplyr)
 # the data is returned in wide form
 results <- iris %>%
   select(Sepal.Length, Sepal.Width, Petal.Length, Petal.Width) %>%
   estimate_profiles(3)
 get_data(results)

 # note that if more than one model is fit, the data is returned in long form
 results1 <- iris %>%
   select(Sepal.Length, Sepal.Width, Petal.Length, Petal.Width) %>%
   estimate_profiles(c(3, 4))
 get_data(results1)
 }

## End(Not run)

jrosen48/tidyLPA documentation built on Feb. 23, 2024, 11:33 p.m.