data_extract_or_assign: Extract or assign data from an xpose.data object.

data_extract_or_assignR Documentation

Extract or assign data from an xpose.data object.

Description

Extracts or assigns the data from the Data or SData slots in an "xpose.data" object.

Usage

Data(object, inclZeroWRES = FALSE, onlyfirst = FALSE, subset = NULL)

Data(object, quiet = TRUE, keep.structure = F) <- value

SData(
  object,
  inclZeroWRES = FALSE,
  onlyfirst = FALSE,
  subset = NULL,
  samp = NULL
)

SData(object) <- value

Arguments

object

An "xpose.data" object

inclZeroWRES

Logical value indicating whether rows with WRES==0 should be included in the extracted data.

onlyfirst

Logical value indicating whether only the first line per individual should be included in the extracted data.

subset

Expression with which the extracted data should be subset (see xsubset)

quiet

TRUE or FALSE if FALSE then some more information is printed out when adding data to an Xpose object.

keep.structure

TRUE or FALSE ifFALSE then values are converted to continuous or categorical according to the rules set up by xpose using object@Prefs@Cat.levels, object@Prefs@DV.cat.levels and the values in the "catab" file.

value

An R data.frame.

samp

An integer between 1 and object@Nsim (seexpose.data-class) specifying which of the simulated data sets to extract from SData.

Details

When using Data to assign a data.frame to the Data slot in the "xpose.data" object a number of things happen:

Each column in the data.frame is checked and set to factor if the number of unique values are less than the value of Cat.levels (see xpose.prefs-class).

It is checked which of the predefined xpose data variables that exists in the data.frame. The variable definitions that does not exist are set to NULL.

The column identified by the dv xpose variable definition, is checked and set to factor if the number of unique values are less than or equal to the DV.Cat.levels (see xpose.prefs-class).

Finally, each column name in the data.frame is checked for a label (see xpose.prefs-class). If it is non-existent, the label is set to the column name.

When SData is used to assign a data.frame to the SData slot it is first checked that the number of rows in the SData data.frame is an even multiple of the number of rown in Data. Next, each column in the SData data.frame is assigned the same class as the corresponding column in the Data data.frame (it is required that the columns are the same in Data and SData). Finally, an extra column, "iter", is added to SData, which indicates the iteration number that each row belongs to. At the same time, the Nsim slot of the "xpose.data" object is set to the number of iterations (see nsim).

Value

Returns a data.frame from the Data or SData slots, excluding rows as indicated by the arguments.

Functions

  • Data(): Extract data

  • Data(object, quiet = TRUE, keep.structure = F) <- value: assign data

  • SData(): extract simulated data

  • SData(object) <- value: assign simulated data

Author(s)

Niclas Jonsson

See Also

xpose.data-class,xpose.prefs-class

Other data functions: add_transformed_columns, change_graphical_parameters, change_misc_parameters, compute.cwres(), data.checkout(), db.names(), export.graph.par(), export.variable.definitions(), import.graph.par(), import.variable.definitions(), make.sb.data(), nsim(), par_cov_summary, read.TTE.sim.data(), read.nm.tables(), read_NM_output, read_nm_table(), simprazExample(), tabulate.parameters(), xlabel(), xpose.data, xpose.print(), xpose4-package, xsubset()

Examples


xpdb <- simpraz.xpdb

## Extract data
my.dataframe <- Data(xpdb)

## Assign data
Data(xpdb) <- my.dataframe

## Extract simulated data
my.simulated.dataframe <- SData(xpdb)

## Assign simulated data
SData(xpdb) <- my.simulated.dataframe


xpose4 documentation built on May 29, 2024, 7:56 a.m.