|
R is a powerful programming language for data analysis.
|
|
Efficient data import/export is crucial for data manipulation and analysis.
|
|
This cheatsheet provides quick reference on reading/writing various file types in R.
|
|
Proper data import/export enhances R's data analysis capabilities.
|
|
Use this cheatsheet as a handy reference guide in your R programming journey.
|
|
Thank you for using this "Data Import/Export in R" cheatsheet.
|
|
For more resources, visit my website[https://vccv.cc].
|
|
Import
|
Export
|
read.csv(file, |
write.csv(x, |
|
File:
the name of the file which the data are to be read from. |
X:
the object to be written, preferably a matrix or data frame. |
|
Import
|
Export
|
read.table(file, |
write.table(x, |
|
File:
the name of the file which the data are to be read from. |
X:
the object to be written, preferably a matrix or data frame. |
|
Code: read.table(file, header=TRUE)
|
Code: write.table(x, export.txt)
|
|
Video
|
HDF5
|
|
Read Video:
videoplayR::readMP4() |
Read HDF5:
hdf5r::h5read() |
|
Write Video:
videoplayR::writeMP4() |
Write HDF5:
hdf5r::h5write() |
|
netCDF
|
|
|
Read netCDF:
ncdf4::nc_open() |
Write netCDF:
ncdf4::ncvar_put() |
|
TSV
|
RDS
|
RDA
|
|
Read TSV:
read.table() |
Read RDS:
readRDS() |
Read RDA:
attach() |
|
Write TSV:
write.table() |
Write RDS:
saveRDS() |
|
|
JSON
|
XML
|
|
Read JSON:
jsonlite::fromJSON() |
Read XML:
XML::xmlTreeParse() |
|
Write JSON:
jsonlite::toJSON() |
Write XML:
XML::saveXML() |
|
XLS
|
XLSX
|
|
Read XLS:
readxl::read_excel() |
Read XLSX:
readxl::read_xlsx() |
|
Write XLS:
writexl::write_xlsx() |
Write XLSX:
writexl::write_xlsx() |
|
Image
|
Audio
|
|
Read Images:
jpeg::readJPEG(), png::readPNG(), tiff::readTIFF(), bmp::readBMP() |
Read Audio:
tuneR::readMP3() |
|
Write Images:
jpeg::writeJPEG(), png::writePNG(), tiff::writeTIFF(), bmp::writeBMP() |
Write Audio:
tuneR::writeMP3() |
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.