1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{splitForm}
\alias{splitForm}
\alias{noSpecials}
\title{Split formula containing special random effect terms}
\usage{
splitForm(
formula,
defaultTerm = "us",
allowFixedOnly = TRUE,
allowNoSpecials = TRUE,
debug = FALSE,
specials = findReTrmClasses()
)
noSpecials(term, delete = TRUE, debug = FALSE, specials = findReTrmClasses())
}
\arguments{
\item{formula}{a formula containing special random effect terms}
\item{defaultTerm}{default type for non-special RE terms}
\item{allowFixedOnly}{(logical) are formulas with no RE terms OK?}
\item{allowNoSpecials}{(logical) are formulas with only standard RE terms OK?}
\item{debug}{debugging mode (print stuff)?}
\item{term}{language object}
}
\value{
a list containing elements \code{fixedFormula};
\code{reTrmFormulas} list of \code{x | g} formulas for each term;
\code{reTrmAddArgs} list of function+additional arguments, i.e. \code{list()} (non-special), \code{foo()} (no additional arguments), \code{foo(addArgs)} (additional arguments); \code{reTrmClasses} (vector of special functions/classes, as character)
}
\description{
Parse a formula into fixed formula and random effect terms,
treating 'special' terms (of the form foo(x|g[,m])) appropriately
}
\details{
Taken from Steve Walker's lme4ord,
ultimately from the flexLambda branch of lme4
\url{https://github.com/stevencarlislewalker/lme4ord/blob/master/R/formulaParsing.R}. Mostly for internal use.
}
\examples{
splitForm(~x+y) ## no specials or RE
splitForm(~x+y+(f|g)) ## no specials
splitForm(~x+y+diag(f|g)) ## one special
splitForm(~x+y+(diag(f|g))) ## 'hidden' special
splitForm(~x+y+(f|g)+cs(1|g)) ## combination
splitForm(~x+y+(1|f/g)) ## 'slash'; term
splitForm(~x+y+(1|f/g/h)) ## 'slash'; term
splitForm(~x+y+(1|(f/g)/h)) ## 'slash'; term
splitForm(~x+y+(f|g)+cs(1|g)+cs(a|b,stuff)) ## complex special
splitForm(~(((x+y)))) ## lots of parentheses
splitForm(~1+rr(f|g,n=2))
splitForm(~1+s(x, bs = "tp"))
noSpecials(y~1+us(1|f))
noSpecials(y~1+us(1|f),delete=FALSE)
noSpecials(y~us(1|f))
noSpecials(y~us(1|f), delete=FALSE)
noSpecials(y~us(1|f), debug=TRUE)
noSpecials(y~us+1) ## should *not* delete unless head of a function
noSpecials(~us(1|f)+1) ## should work on a one-sided formula!
noSpecials(~s(stuff) + a + b, specials = "s")
noSpecials(cbind(b1, 20-b1) ~ s(x, bs = "tp"))
}
\author{
Steve Walker
}
\keyword{internal}
|