...
- use the
write.csv
orwrite.table
R functions to write tables to file
Code Block | ||||
---|---|---|---|---|
| ||||
#output# output to the R console > ds.table2D(x='D$DIS_DIAB', y='D$GENDER') # #printsprints to the current working directory into a file called test_table.csv > write.csv(x=ds.table2D(x='D$DIS_DIAB', y='D$GENDER'), file = "test_table.csv") |
...
- To do this an image writing function such as
png()
,pdf()
orpostscript()
needs to be opened. - Each file to be written must be put on seperate lines
- The print device needs closing.
- All images are written to the current working directory in R.
Code Block | ||||
---|---|---|---|---|
| ||||
#png# a png example png(filename = "image_name.png", width = 900, height = 700, units = "px", pointsize = 12, bg = "white", type = "cairo") ds.histogram(x='D$LAB_HDL') dev.off() |
...
Code Block | ||||
---|---|---|---|---|
| ||||
# a pdf example pdf (file = "image_name.pdf") ds.histogram(x='D$LAB_HDL') ds.histogram(x='D$LAB_HDL', type='split') dev.off() |
...
Code Block | ||||
---|---|---|---|---|
| ||||
# a postscript example postscript(file = "image_name.ps", paper = "special", width = 9, height = 7, onefile = TRUE, horizontal = FALSE) ds.histogram(x='D$LAB_HDL') ds.histogram(x='D$LAB_HDL', type='split') dev.off() |
...
Code Block | ||||
---|---|---|---|---|
| ||||
# print to file the non-disclosive data that comprises a histogram out<out <- capture.output(ds.histogram(x='D$LAB_HDL')) cat(out, file="name.txt", sep="\n", append=TRUE) |
Tip |
---|
All arguments to customise the above functions can be found in their respective function manual pages. |
...