Top Packages in R – Data Import and Export
Data needed to perform analysis can be in any format or any structure. Hence we need ways to import such data into R. Also we need to write or export the results of the analysis or update the data in the files. Hence Data Import and Export is an important aspect of Data Analysis.
This is the 3rd part of our Top Packages in R Series.
In first part, we talked about the most useful and top packages for Data Visualization in R and in the second part we talked about top packages for Data Wrangling(Manipulation). If you haven’t seen these part you can read them her
For this post we are going to talk about top packages in R for Data Import and Export.
Data Import and Export
base R (Basic Functions)
These are inbuilt functions provided by R.
- read.table – Read a delimited text file.
- read.csv – Read a comma separated value file.
- load – Read an R data file, a file type special for R.
- write.table – Write a delimited text file.
- write.csv – Write a comma separated value file.
- save – Write an R data file, a file type special for R.
foreign
Provides functions that helps read and write from other programs into R.
Writing and Reading the data stored by different versions of ‘Epi Info’, ‘Minitab’, ‘SPSS’, ‘Stata’, ‘S’, ‘SAS’, ‘Systat’, ‘Weka’, and for writing and reading some ‘dBase’ files.
Function in foreign:
- write.dta – Write Files in Stata Binary Format
- write.dbf – Write a DBF File
- write.arff – Write Data into ARFF Files
- write.foreign – Write Text Files and Code to Read Them
- read.ssd – Obtain a Data Frame from a SAS Permanent Dataset, via read.xport
- read.dta – Read Stata Binary Files
- read.dbf – Read a DBF File
- read.arff – Read Data from ARFF Files
- read.epiinfo – Read Epi Info Data Files
- read.systat – Obtain a Data Frame from a Systat File
- read.spss – Read an SPSS Data File
- read.xport – Read a SAS XPORT Format Library
- read.mtp – Read a Minitab Portable Worksheet
- read.octave – Read Octave Text Data Files
- lookup.xport – Lookup Information on a SAS XPORT Format Library
- S3 read functions – Read an S3 Binary or data.dump File
readr
Provide a fast and friendly way to read rectangular data (like ‘csv’, ‘tsv’, and ‘fwf’). It is designed to easily parse different types of data found in the wild.
Core read functions:
- read_csv() – comma separated (CSV) files
- read_tsv() – tab separated files
- read_delim() – general delimited files
- read_fwf() – fixed width files
- read_table() – tabular files where colums are separated by white-space.
- read_log() – web log files
RMySQL, RPostgresSQL, RSQLite
For reading data from a database, these are some of the packages. Choose the package by the type type of your database.
XLConnect, xlsx
Provides a way to read and write through Microsoft Excel files from R. You can also export the spreadsheets as .csv’s.
Conclusion
Thanks for reading Top Packages in R – Data Import and Export. Follow our website to learn about latest technologies, and concepts.
For any queries feel free to comment down below. You can also continue reading our post on Data Import Export Packages in R