as.mlds.df: Coerces a data.frame to mlds.df

as.mlds.dfR Documentation

Coerces a data.frame to mlds.df

Description

Coerce a data frame from an MLDS experiment to an object of class mlbs.df or mlds.df by adding column names and attributes so that it will be properly treated by methods related to the MLDS functions.

Usage

as.mlds.df(d, ...)
as.mlbs.df(d, ...)

## S3 method for class 'data.frame'
as.mlds.df(d, st, ...)
## S3 method for class 'data.frame'
as.mlbs.df(d, st, ...)


df2mlds.df(d, st)

Arguments

d

a 4 or 5 column data frame from an MLDS experiment, with one column of responses followed by three or four, respectively, indicating the indices of the stimuli from each trial or a data frame of > 5 columns with the response in the first column and the covariates (signed indicator variables) for the stimuli of each trial in the rest of the columns

st

numeric indicating the stimulus levels from the MLDS experiment

...

additional arguments passed to the methods

Details

This function coerces a data frome from an MLDS experiment to an object of class mlbs.df or mlds.df but inheriting from class data.frame. It changes the column names to resp and S1, S2, S3 and if a quad experiment, S4 and adds two attributes: stimulus, a vector of scale values used in plotting the estimated scale and invord, a logical vector indicating the order of the presentation of pairs (were the larger scale values on the bottom or not) which is used with the SwapOrder function. Note that when the argument is in signed indicator form, just a data frame is returned with no special mlds attributes.

Value

data.frame of class mlbs.df or mlds.df with stimulus and invord attributes, unless the input is in signed indicator form. See details.

Note

If the scale starts at 0, then 1 should be added to each scale value because the scale values will be used as indices and R indices start at 1, not 0.

Author(s)

Kenneth Knoblauch

See Also

mlds


MLDS documentation built on Aug. 20, 2023, 9:06 a.m.