as.smooths.frame: Forms a 'smooths.frame' from a 'data.frame', ensuring that...

as.smooths.frameR Documentation

Forms a smooths.frame from a data.frame, ensuring that the correct columns are present.

Description

Creates a smooths.frame from a data.frame by adding the class smooths.frame and a set of attributes to it.

Usage

as.smooths.frame(data, individuals = NULL, times = NULL)

Arguments

data

A data.frame containing the results of smoothing the data on a set of individuals over time, the data being arranged in long format both with respect to the times and the smoothing-parameter values. It must contain the columns Type, TunePar, TuneVal, Tuning and Method that give the smoothing-parameter values that were used to produce each smooth of the data, as well as the columns identifying the individuals, the observation times of the responses and the unsmoothed and smoothed responses. Each response occupies a single column.

individuals

A character giving the name of the factor that defines the subsets of the data for which each subset corresponds to the response values for an individual (e.g. plant, pot, cart, plot or unit).

times

A character giving the name of the numeric, or factor with numeric levels, that contains the values of the predictor variable to be supplied to smooth.spline and to be plotted on the x-axis.

Value

A smooths.frame

Author(s)

Chris Brien

See Also

validSmoothsFrame, as.smooths.frame

Examples

dat <- read.table(header = TRUE, text = "
Type TunePar TuneVal Tuning Method       ID  DAP   PSA      sPSA
NCSS      df       4   df-4 direct 045451-C   28 57.446 51.18456
NCSS      df       4   df-4 direct 045451-C   30 89.306 87.67343
NCSS      df       7   df-7 direct 045451-C   28 57.446 57.01589
NCSS      df       7   df-7 direct 045451-C   30 89.306 87.01316
")
dat[1:7] <- lapply(dat[1:6], factor)
dat <- as.smooths.frame(dat, individuals = "ID", times = "DAP")
is.smooths.frame(dat)
validSmoothsFrame(dat)

growthPheno documentation built on Oct. 24, 2023, 5:08 p.m.