convEffectNames2DataFrame.asreml: Converts the effects names for a term stored in the component...

View source: R/asremlPlusObjUtils.r

convEffectNames2DataFrame.asremlR Documentation

Converts the effects names for a term stored in the component of an asreml object into a data.frame.

Description

Converts the effects names for a term stored in the component of an asreml object into a data.frame that has a column for each factor and variable in the term. It facilitates adding the effects to the data.frame supplied to asreml for an analysis. This function can only be used with asreml v4.2 or later.

Usage

## S3 method for class 'asreml'
convEffectNames2DataFrame(asreml.obj, term, use = "design.matrix", sep = ":", ...)

Arguments

asreml.obj

An object resulting from the fitting of a model using asreml v4.2.

term

A character nominating a single model term. It should be the name of the term in the component, of the asreml.obj, nominated in the use argument. The variables/factors in term must match those in this component. Thus, it will not include asreml variance or correlation functions, but may include functions such at at. Generally, each element of the term, separated from other elements by colons, should involve a single factor or variable.

use

A character specifying a component in the asreml.obj. The default is the design.matrix. Other possibilities are the random.coeffs or G.aom. For the option design.matrix, the design argument of asreml.options must be set to TRUE, before executing either the asreml or update.asreml call produces the asreml.obj. The option G.aom specifies the G component of the aom component that is included in the asreml.obj if the aom argument is set to TRUE in either asreml.options before calling asreml or update.asreml, or in a call to asreml or update.asreml that is involved in producing the asreml.obj.

sep

A character specifying the separator of factors/variables in the term.

...

Provision for passing arguments to functions called internally - not used at present.

Value

A data.frame with columns for the factors and variables in term. It includes the attribute effect.names that contains the extracted effects names for the term

Author(s)

Chris Brien

References

Butler, D. G., Cullis, B. R., Gilmour, A. R., Gogel, B. J. and Thompson, R. (2023). ASReml-R Reference Manual Version 4.2. VSN International Ltd, https://asreml.kb.vsni.co.uk/.

Examples

## Not run: 
    G.dat <- convEffectNames2DataFrame(m1.asr, term = "Row:Column", use = "G.aom")
    
    G.dat <- lapply(c("at(Smarthouse, 'SW'):Lane:Position", 
                      "at(Smarthouse, 'SE'):Lane:Position"), 
                   function(term, asreml.obj)
                     tmp <- convEffectNames2DataFrame.asreml(asreml.obj, term = term),
                   asreml.obj = m1.asr)
    G.dat <- do.call(rbind, G.dat)

## End(Not run)

asremlPlus documentation built on Oct. 27, 2024, 5:06 p.m.