Learn R Programming

BIOdry (version 0.3)

levexp: Vector releveling

Description

Expansion or reduction of a numeric vector by matching its levels with the factor-level columns in a data frame.

Usage

levexp(x, levels)

Arguments

x
numeric vector with names of the vector representing the levels to be matched.
levels
data.frame with factor-level columns, or character vector of levels.

Value

Examples

Run this code
##Multilevel data frame of tree-ring widths:
data(Prings05,envir = environment())
## Radial increments measured on 2003:
data(Pradii03,envir = environment())    

## Getting the factor-level names at sample level
ntl <- names(splitFrame(Prings05,'sample'))
## Releveling the radii
refs <- levexp(Pradii03,ntl)

Run the code above in your browser using DataLab