Split elements into groups based on a given column of a dataset
Source:R/groups.R
createGroupByAttribute.Rd
Elements are identified by their respective row name.
See also
Other functions for data grouping:
getGeneList()
,
getSampleFromSubject()
,
getSubjectFromSample()
,
groupPerElem()
,
plotGroupIndependence()
,
testGroupIndependence()
Examples
df <- data.frame(gender=c("male", "female"),
stage=paste("stage", c(1, 3, 1, 4, 2, 3, 2, 2)))
rownames(df) <- paste0("subject-", LETTERS[1:8])
createGroupByAttribute(col="stage", dataset=df)
#> $`stage 1`
#> [1] "subject-A" "subject-C"
#>
#> $`stage 2`
#> [1] "subject-E" "subject-G" "subject-H"
#>
#> $`stage 3`
#> [1] "subject-B" "subject-F"
#>
#> $`stage 4`
#> [1] "subject-D"
#>