write.csv.R
write.csv.Rd
Save summaries of partitioned breeding values to CSV files on disk for further analyses of processing with other software or just for saving (backing up) results.
Usage
write.csv(...)
# S3 method for default
write.csv(...)
# S3 method for AlphaPart
write.csv(x, file, traitsAsDir = FALSE, csv2 = TRUE, row.names = FALSE, ...)
# S3 method for summaryAlphaPart
write.csv(x, file, traitsAsDir = FALSE, csv2 = TRUE, row.names = FALSE, ...)
Arguments
- ...
Other options passed to
write.csv2
orwrite.csv
.- x
AlphaPart, object returned from
AlphaPart
function or summaryAlphaPart, object returned fromsummary.AlphaPart
function.- file
Character, file name with or without .csv extension, e.g., both "file" and "file.csv" are valid.
- traitsAsDir
Logical, should results be saved within trait folders; the construction is
file.path(dirname(file), trait, basename(file))
; folders are created if they do not exist.- csv2
Logical, export using
write.csv2
orwrite.csv
.- row.names
Logical, export row names as well?
Value
It contains:
write.csv
- seewrite.csv
for details.write.csv.AlphaPart
- for each trait (list component inx
) a file is saved on disk with name "AlphaPart_trait.csv", where the file will hold original data and breeding value partitions. WithtraitsAsDir=TRUE
files are saved as "trait/file_trait.csv". File names are printed on screen during the process of export and at the end invisibly returned.write.csv.summaryAlphaPart
- for each trait (list component inx
) a file partitions named "file_trait.csv" is saved on disk. WithtraitsAsDir=TRUE
files are saved as "trait/file_trait_*.csv". File names are printed on screen during the process of export and at the end invisibly returned.
Details
Function write.csv
from the utils package works
when exported object is a data.frame
or a
matrix
. This is an attempt to make this function generic
so that one can define write.csv
methods for other objects.
Methods (by class)
default
: Defaultwrite.csv
method.AlphaPart
: Save partitioned breeding values to CSV files on disk on disk for further analyses or processing with other software or just for saving (backing up) results.summaryAlphaPart
: Save summaries of partitioned breeding values to CSV files on disk for further analyses of processing with other software or just for saving (backing up) results.
See also
write.csv
help page on the default write.csv
and write.csv2
methods in the utils package;
summary.AlphaPart
and AlphaPart
help pages on the objects of summaryAlphaPart
and AlphaPart
classes.
Examples
## Partition additive genetic values
res <- AlphaPart(x=AlphaPart.ped, colPath="country", colBV=c("bv1", "bv2"))
#>
#> Size:
#> - individuals: 8
#> - traits: 2 (bv1, bv2)
#> - paths: 2 (domestic, import)
#> - unknown (missing) values:
#> bv1 bv2
#> 0 0
## Write summary on the disk and collect saved file names
fileName <- file.path(tempdir(), "AlphaPart")
ret <- write.csv(x=res, file=fileName)
#> /tmp/RtmpGflKKv/AlphaPart_bv1.csv
#> /tmp/RtmpGflKKv/AlphaPart_bv2.csv
print(ret)
#> [1] "/tmp/RtmpGflKKv/AlphaPart_bv1.csv" "/tmp/RtmpGflKKv/AlphaPart_bv2.csv"
file.show(ret[1])
## Clean up
files <- dir(path=tempdir(), pattern="AlphaPart*")
unlink(x=files)