exportCoCo {CoCoRaw} | R Documentation |
Export and import a binary file with the CoCo data and the models.
exportCoCo(file.name, data = NULL, object = .object.of.thing(data = data, ...), ...) importCoCo(file.name, setslot = TRUE, data = NULL, object = .object.of.thing(data = data, ...), ...)
file.name |
A character string naming the file to write to. |
setslot |
Logical, if setslot is TRUE then the entered
value of file.name is added to the CoCo object ,
such that the object can be recovered
after ending the CoCo object by,
e.g. endCoCo ,
or after terminating the R session and restarting R. |
data |
An optional argument with the "data", only used if
the argument object is not given.
If the class of data is "table" or "array" ,
then the table is entered into a pure discrete CoCo object.
If the class of data is "data.frame"
(or "matrix" ),
then the data frame is entered into a CoCoCg object.
Columns of class "factor"
will for data of class "data.frame"
be considered as discrete variables,
and columns of class "numeric"
will be considered as continuous variables.
Columns of class "numeric" can be converted to
discrete variables by the argument to.factor ,
see enterDataFrame .
|
object |
The CoCo object with the data and models to use.
If neither object or data is given,
then the object .current.coco of
.GlobalEnv is used as default object,
see makeCurrentCoCo .
|
... |
Additional arguments to generate the CoCo object
from the data argument. See propertyModel . |
Options, the values of optionsCoCo
is not exported,
as neither is the setting of setUseVariables
,
excludeMissing
, and emOn
.
enterQtable
and enterQlist
are exported.
A character string with the file name file.name
.
exportCoCo
and importCoCo
is
intended to facilitate using the same data in R+CoCo, Xlisp+CoCo and
standalone CoCo by only entering the data into one of the programs.
Once the data has been entered into CoCo in one of the three systems,
the data can be exported, and then imported to a standalone CoCo
or CoCo loaded under the other system. This will work with the same
version number of CoCo, and probably also between different platforms
(Unix, Linux, Windows, etc.). In future versions of CoCo the format
of the binary file might change, and thus the binary files from
exportCoCo
should not be used for storing data.
Jens Henrik Badsberg
library(MASS) data(anorexia) library(CoCoCg); # Without "data" require ending the CoCo object: # exportCoCo("Anorexia.xpt", data = anorexia); # endCoCo(); # With CoCo object: library(CoCoCg); data(Rats); CoCoObject <- makeCoCoCg(); enterDataFrame(Rats, object = CoCoObject); exportCoCo("Rats.xpt", object = CoCoObject); endCoCo(object = CoCoObject); # Import the first example: Anorexia <- makeCoCo(); importCoCo("Anorexia.xpt", object = Anorexia); showOptions("specification"); endCoCo(object = Anorexia); # Import the second example: Rats <- makeCoCoCg(); importCoCo("Rats.xpt", object = Rats); showOptions("specification"); endCoCo(object = Rats);