export.design: Function for exporting a design object

View source: R/export.design.R

export.designR Documentation

Function for exporting a design object

Description

Function for exporting a design object

Usage

export.design(design, response.names = NULL, 
       path = ".", filename = NULL, legend = NULL, type = "html", 
       OutDec = options("OutDec")$OutDec, replace = FALSE, version = 2, ...)
html(object, ...)
## S3 method for class 'data.frame'
html(object, file = paste(first.word(deparse(substitute(object))),
    "html", sep = "."), append = FALSE, link = NULL, linkCol = 1, bgs.col = NULL,
          OutDec=options("OutDec")$OutDec, linkType = c("href", "name"), ...)

Arguments

design

A data frame of class design; it must be stored in the global environment and referred to by its name, i.e. it cannot be created “on the fly”.

response.names

if not NULL (default), this must be a character vector of response names; the exported file contains a column for each entry; it is NOT necessary to include responses that are already present in the design object!

path

the path to the directory where the export files are to be stored; the default corresponds to the R working directory that can (on some systems) be looked at using getwd()

filename

character string that gives the file name (without extension) for the files to be exported; if NULL, it is the name of the design object

legend

data frame containing legend information; if NULL, the legend is automatically generated from the factor.names element of design.info(design)

type

one of "rda", "html", "csv", or "all". An R workspace with just the design object is always stored as an "rda" object. If one of the other types is specified, the design is additionally exported to "html" or "csv" or both. The "csv" file contains the design itself only, with formatting depending on the OutDec option. The "html" file contains some additional legend information and row color formatting.

OutDec

decimal separator for the output file; one of "." or ","; the default is the option setting in the R options; this option also directs whether write.csv or write.csv2 is used and is very important for usability of the exported files e.g. with Excel

replace

logical indicating whether an existing file should be replaced; if FALSE (default), the routine aborts without any action if one of the files to be created exists; checking is not case-sensitive in order to protect users on case-insensitive platforms from inadvertent replacing of files (i.e. you cannot have TEST.html and test.html, even if it were allowed on your platform)

version

the save version for the rda file; starting with R 3.6.0, the default save version is 3; that version cannot be read by R versions before 3.5.0. Therefore, the default of this package is still 2, but can be overwritten by users who are certain to use the file only on new R versions.

object

object to be exported to html

file

file to export the object to

append

append data frame to existing file ?

link

not used, unchanged from package Hmisc

linkCol

not used, unchanged from package Hmisc

bgs.col

background colors for data frame rows, default white and grey

linkType

not used, unchanged from package Hmisc

...

further arguments to function html, usable e.g. for modifying row coloring

Details

Function export.design always stores an R workspace that contains just the design (with attached attributes, cf. class design). This file is stored with ending rda.
If requested by options type="csv", type="html", or type="all", export.design additionally creates an exported version of the design that is usable outside of R. This is achieved via functions write.csv, write.csv2 or html. The csv-file contains the data frame itself only, the html file contains the data frame followed by the legend to the right of the data frame. The html file uses row coloring in order to prevent mistakes in recording of experimental results by mix-ups of rows. If the OutDec option is correct for the current computer, the csv and html files can be opened in Excel, and decimal numbers are correctly interpreted.

Generation of the html-file is particularly important for Taguchi inner/outer array designs in wide format, because it provides the legend to the suffix numbers of response columns in terms of outer array experimental setups!

The function html and its data frame method are internal.

Value

The functions are used for their side effects and do not generate a result.

Note

This package is currently under intensive development. Substantial changes are to be expected in the near future.

Author(s)

Ulrike Groemping; the html functions have been adapted from package Hmisc

References

Hedayat, A.S., Sloane, N.J.A. and Stufken, J. (1999) Orthogonal Arrays: Theory and Applications, Springer, New York.

See Also

See also FrF2-package, DoE.wrapper-package

Examples

  ## six 2-level factors
  test <- oa.design(nlevels=c(2,3,3,3))
  ## export an html file with legend and two responses
  ## files test.rda and test.html will be written to the current working directory, 
  ##     if they do not exist yet
  ## Not run: 
  export.design(test, response.names=c("pressure", "temperature"))
  
## End(Not run)

DoE.base documentation built on Nov. 15, 2023, 1:06 a.m.