Contents
savePolyGenius
Save a PolyGenius object to a single, self-contained file
Writes study to a file (suffix .pgd) that loadPolyGenius() can read back, on this machine
or any other. Dispatch is on class(study), and the payload records the class so the load side
dispatches the same way; see ?PolyGenius-backends for what each kind carries and what the
format does not keep.
Usage
savePolyGenius(study, path)S3 method for class 'PolyGeniusStudy'
savePolyGenius(study, path)S3 method for class 'PGSLibrary'
savePolyGenius(study, path)S3 method for class 'PGS'
savePolyGenius(study, path)S3 method for class 'PolyGeniusAssociation'
savePolyGenius(study, path)S3 method for class 'PolyGeniusEvaluation'
savePolyGenius(study, path)Default S3 method:
savePolyGenius(study, path)Arguments
| Argument | Description |
|---|---|
study | The object to write: a PolyGeniusStudy, PGSLibrary, PGS, PolyGeniusAssociation, or PolyGeniusEvaluation. For the model-bearing kinds a subset produced by subset()/[ round-trips as well as a full object. |
path | Character scalar. Destination file path; .pgd is appended when the path does not already end in it (case-insensitively). A relative path is resolved against the current working directory. |
Value
path, with the .pgd suffix applied, invisibly. Called for the side effect of
writing the file.
Details
Any existing file at path is replaced. A path whose parent directory does not exist aborts
without writing anything. Saving aborts when there is nothing to write -- a PolyGeniusStudy or
PGSLibrary with no models -- and when anything reachable from the object is a
function or environment rather than data.
Examples
savePolyGenius(data, "cohort1.pgd")
data2 <- loadPolyGenius("cohort1.pgd")
# Every other supported kind saves and loads through the same two functions:
savePolyGenius(my.library, "library.pgd") # a standalone PGSLibrary
savePolyGenius(my.assoc, "assoc.pgd") # a PolyGeniusAssociation