Description Usage Arguments Details Value Author(s) References See Also Examples
write.SeerStat writes data and dictionary information to files in the format of SEER*STAT export files
1 | write.SeerStat(myData, DICfileName, TXTfileName = NULL, UseVarLabelsInTxtFile = TRUE, LabVarsNames = NULL,...)
|
myData |
: A data.frame object to be output. It may have an attribute 'DICInfo'. If no 'DICInfo' defined, then a default 'DICInfo' will be created and used for generating the dic file. |
DICfileName |
: filename of the dic file. The default extention is 'dic'. If 'DICfileName' does not contain at the end a string '.dic' (letter case does not matter), then '.dic' will be added. |
TXTfileName |
: filename of the associated data file. If TXTfileName = NULL, then a string of DICfileName with extention substituted by 'txt' (for uncompressed data file) or 'gz' (for gzip compressed data file) will be used (whether 'txt' or 'gz' depends on the attribute variable 'DICInfo' of the data.frame object 'myData'). |
UseVarLabelsInTxtFile |
: a logic value. If true, then variable labels will be output into the associated data file. If false, then the numeric values will be output. The variables, labels of which are to be output, are all character or factor columns of 'myData' if LabVarsNames = NULL, otherwise they are defined by 'LabVarsNames'. |
LabVarsNames |
: a name list of variables in the data.frame 'myData', labels of which will be output into the associated data file, instead of numeric values. |
... |
:
Arguments to be passed to |
“write.SeerStat” writes an object of data.frame to a SEER*Stat data file and creates the associated dictionary file that is in the format of SEER*Stat dictionary files. The variable names of the SEER*Stat data file are the same as the column names of the data.frame object. The contents of sections of dictionary file are based on the attribute variable “DICInfo" of the data.frame object. If users do not define an attribute variable “DICInfo" of the data.frame object, then default values will be used.
The 'DICInfo' actually used for writing to the dictionary file and the associated data file will be returned.
Jun Luo
Maintainer: Jun Luo <rpackages@gmail.com>
Jun Luo and Binbing Yu, 'SEER2R: An interface between SEER cancer registry data and R'
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #load testing data: there are three data objects, i.e. SEER2RTestData1,SEER2RTestData2,SEER2RTestData3
data("SEER2RTestdata");
#create one SEER*STAT export dic and the associated text data file for testing purpose
dicinfoused = write.SeerStat(SEER2RTestData2, DICfileName = "testrun1.dic",UseVarLabelsInTxtFile=FALSE);
#usage of read.SeerStat
mydata = read.SeerStat("testrun1.dic",UseVarLabelsInData=FALSE);
#get informatin inside the dic file
DICInfo = attr(mydata, "DICInfo");
#change names of columns whose names contains strings "site" or "sex";
#the order of strings does not matter
testdatanewnames = attr(mydata,"assignColNames")(mydata,c("sex","site"));
#extract columns whose names contains strings "site" or "sex";
testdata = attr(mydata,"getSubDataByVarName")(mydata,c("site","sex"));
#usage of write.SeerStat
dicinfoused = write.SeerStat(mydata, DICfileName = "testrun2.dic", UseVarLabelsInTxtFile = FALSE);
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.