Learn R Programming

DoE.base (version 0.5)

fix.design: Function to preserve class design when editing a design

Description

This function allows to type in response data and other additional information like date or comments for experimental runs in R, such that all attributes of the design objects are updated accordingly. However, it is recommended to do such editing tasks outside of R, as R is not ideal for these.

Usage

### generic function
fix(x, ...)
## S3 method for class 'default':
fix(x, ...)
## S3 method for class 'design':
fix(x, ..., prompt=FALSE)

Arguments

x
an object of class design
...
further arguments to function fix from package utils
prompt
logical asking whether user is to be prompted for selecting which new numeric variable is a response; default: all new numeric variables are response variables

Value

  • For the default function, refer to fix and the links therein. The function for class design adds the numeric version (as.numeric) of all newly-entered variables to the desnum attribute of x and appends the names of all newly-entered response variables to the response.names element of the design.info attribute. If numeric variables are to be entered that are no response variables, the function should be called with prompt=TRUE so that these are not taken to be response variables. Automatic default analyses (not yet available) would otherwise include analyses for these variables.

Warning

NOTE: Editing the data in R is only helpful for very small examples, especially when using the default editor under Windows. NEVER do it to the one and only original data file. It does irrevocably replace it in many cases, even if you realize the mistakes you have made before leaving the editor window.

Details

Function fix is made into an S3 generic. The default method preserves the functionality from package utils for all objects that are not of class design. Function fix immediately commits all changes, overwriting the original object without further notice. This is also true for the method applicable to objects of class design, as long as the changes do not destroy the properties of the design. It is therefore wise to keep a copy of the original, until correctness of the changes is ascertained. For design objects, changes are only committed, if no forbidden editing has been done: Changes in values of the experimental factors are not allowed and prevent storing edited information (only reported after the fact, user has no choice in the matter). If the editing would destroy the structure of the design, e.g. because something was typed into an empty row of the data editor which leads to an extra row with missing values, a prompt allows to abort the changes; if changes are committed, the data frame is stored under its original name without any of its attributes (and can thus no longer be treated by any special tools for design objects).

See Also

See also fix and the links therein

Examples

Run this code
plan <- oa.design(L18)
   fix(plan)
    ## manually add some numeric data for the response
   response.names(plan)
   fix(plan, prompt=TRUE)
    ## manually add at least two numeric response columns
    ## select from menu which ones are to be responses
   response.names(plan)

Run the code above in your browser using DataLab