orderData: Re-Order Data.Frame

View source: R/utils.R

orderDataR Documentation

Re-Order Data.Frame

Description

Functions attempts to standardize input data for linear mixed model analyses to overcome the problem that analysis results sometimes depend on ordering of the data and definition of factor-levels.

Usage

orderData(Data, trms, order.data = TRUE, exclude.numeric = TRUE, quiet = FALSE)

Arguments

Data

(data.frame) with input data intented to put into standard-order

trms

(formula, terms) object speciying a model to be fitted to Data

order.data

(logical) TRUE = variables will be increasingly ordered, FALSE = order of the variables remains as is

exclude.numeric

(logical) TRUE = numeric variables will not be included in the reordering, which is required whenever this variable serves as covariate in a LMM, FALSE = numeric variables will also be converted to factors, useful in VCA-analysis, where all variables are interpreted as class-variables

quiet

(logical) TRUE = omits any (potentially) informative output regarding re-ordering and type-casting of variables

Author(s)

Andre Schuetzenmeister andre.schuetzenmeister@roche.com

Examples

## Not run: 
# random ordering
data(dataEP05A2_1)
dat <- dataEP05A2_1
levels(dat$day) <- sample(levels(dat$day))
# this has direct impact e.g. on order of estimated effects
fit <- anovaVCA(y~day/run, dat, order.data=FALSE)
ranef(fit)
# to guarantee consistent analysis results
# independent of the any data orderings option
# 'order.data' is per default set to TRUE:
fit <- anovaVCA(y~day/run, dat)
ranef(fit)
# which is identical to:
fit2 <- anovaVCA(y~day/run, orderData(dat, y~day/run), order.data=FALSE)
ranef(fit2)

## End(Not run)

VCA documentation built on Sept. 7, 2022, 5:07 p.m.