Newer
Older
% Please edit documentation in R/actual_mainfixeffects.R
\name{subsetByTermLabel}
\alias{subsetByTermLabel}
\title{subset data By Term Label}
\usage{
subsetByTermLabel(data, categorical_vars, term_label)
}
\arguments{
\item{data}{The data frame to subset}
\item{categorical_vars}{The categorical variables to consider}
\item{term_label}{The term label to search for}
}
\value{
A subset of the data frame containing rows where the categorical variables match the specified term label
}
\description{
Get a subset of the data based on a specific term label in the categorical variables.
}
\examples{
# Create a data frame
my_data <- data.frame(color = c("red", "blue", "green", "red"),
size = c("small", "medium", "large", "medium"),
shape = c("circle", "square", "triangle", "circle"))
my_data[] <- lapply(my_data, as.factor)
# Get the subset for the term "medium" in the "size" variable
subsetByTermLabel(my_data, "size", "medium")
# Output: A data frame with rows where "size" is "medium"
# Get the subset for the term "red" in the "color" variable
subsetByTermLabel(my_data, "color", "red")
# Output: A data frame with rows where "color" is "red"
}