This method function extracts the grouping factor associated with object, if any is present.

# S3 method for class 'corStruct'
getGroups(object, form, level, data, sep)

Arguments

object

an object inheriting from class corStruct representing a correlation structure.

form

this argument is included to make the method function compatible with the generic. It will be assigned the value of formula(object) and should not be modified.

level

this argument is included to make the method function compatible with the generic and is not used.

data

an optional data frame in which to evaluate the variables defined in form, in case object is not initialized and the grouping factor needs to be evaluated.

sep

character, the separator to use between group levels when multiple levels are collapsed. The default is '/'.

Value

if a grouping factor is present in the correlation structure represented by object, the function returns the corresponding factor vector; else the function returns NULL.

Author

José Pinheiro and Douglas Bates bates@stat.wisc.edu

See also

Examples

cs1 <- corAR1(form = ~ 1 | Subject)
getGroups(cs1, data = Orthodont)
#>   [1] M01 M01 M01 M01 M02 M02 M02 M02 M03 M03 M03 M03 M04 M04 M04 M04 M05 M05
#>  [19] M05 M05 M06 M06 M06 M06 M07 M07 M07 M07 M08 M08 M08 M08 M09 M09 M09 M09
#>  [37] M10 M10 M10 M10 M11 M11 M11 M11 M12 M12 M12 M12 M13 M13 M13 M13 M14 M14
#>  [55] M14 M14 M15 M15 M15 M15 M16 M16 M16 M16 F01 F01 F01 F01 F02 F02 F02 F02
#>  [73] F03 F03 F03 F03 F04 F04 F04 F04 F05 F05 F05 F05 F06 F06 F06 F06 F07 F07
#>  [91] F07 F07 F08 F08 F08 F08 F09 F09 F09 F09 F10 F10 F10 F10 F11 F11 F11 F11
#> 27 Levels: M01 < M02 < M03 < M04 < M05 < M06 < M07 < M08 < M09 < ... < F11