BuildFormula: Build formula with provided data

Description Usage Arguments Details Value

View source: R/BuildFormula.R

Description

BuildFormula is an internal function that builds a formula from data provided by user to ModelMultiData.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
BuildFormula(
  x,
  y = NULL,
  groups = NULL,
  by = NULL,
  xName = "auto",
  yName = "auto",
  excludeVars = NULL,
  includeVars = NULL
)

Arguments

x

A matrix or list of matrices containing values for model.

y

A matrix containing values to be used on left-hand side of model (e.g. dependent variable). At least one of y or groups must be provided.

groups

A data.frame containing sample group data. At least one of y or groups must be provided. Column one of groups data.frame must contain sample names that correspond to column names of x and y.

by

Character vector specifying column names in groups that will be used to split data if stratified analysis desired. Ignored if groups not provided.

xName

Names of matrices provided in x. If x is a list with named elements, defaults to list names. Else, defaults to x1, x2, ..., xn where n is the number of matrices provided in x.

yName

Name of matrix or name of column in groups to be used on left-hand of model. (see details for default values)

excludeVars

Character vector of column names in groups to exclude from formula. Ignored if formula provided or if groups not provided.

includeVars

Character vector of column names in groups to include in formula. Ignored if formula provided or if groups not provided.

Details

Builds model formula from provided data. By default, the left-hand (dependent) variable will be "y" if y is provided, else if yName is defined the left-hand variable will be defined as the column of groups that matches yName, else the left-hand variable will be defined as the second column of groups after applying includeVars and excludeVars. The right-hand of formula will include all in xName and all remaining columns in groups after applying includeVars and excludeVars.

Value

formula


okg3/MultiDataAnalysis documentation built on March 28, 2020, 12:20 p.m.