Import & Export Data in R
Import & Export Data in R
How to Read Zip Files in R (With Example)
You can use the following basic syntax to read a ZIP file into R:
library(readr)
#import data1.csv located within my_data.zip
df my_data.zip", "data1.csv"))
The following example shows how...
Import & Export Data in R
How to Use read.table in R (With Examples)
You can use the read.table function to read in a file that contains tabular data into R.
This function uses the following basic syntax:
df table(file='C:UsersbobDesktopdata.txt',...
Import & Export Data in R
How to Rename Files in R (With Examples)
You can use the following methods to rename files in R:
Method 1: Rename One File
file.rename(from='old_name.csv', to='new_name.csv')
Method 2: Replace Pattern in Multiple Files
file.rename(list.files(pattern ='old'),
...
Import & Export Data in R
How to Save and Load RDA Files in R (With Examples)
Files that end with an .rda extension represent Rdata files.
You can use the save() function to save these types of files in R:
save(df, file='my_data.rda')
And...
Import & Export Data in R
How to Use colClasses to Quickly Import Data in R
You can use the colClasses argument when importing a file into R to specify the classes of each column:
df csv('my_data.csv',
...
Import & Export Data in R
How to Import TSV Files into R (Including Example)
You can use the following basic syntax to import a TSV file into R:
library(readr)
#import TSV file into data frame
df C:/Users/bob/Downloads/data.tsv')
The following examples show how...
Import & Export Data in R
How to Create a Multi-Line Comment in R (With Examples)
The easiest way to create a multi-line comment in RStudio is to highlight the text and press Ctrl + Shift + C.
You can just...
Subscribe
- Never miss a story with notifications
- Gain full access to our premium content
- Browse free from up to 5 devices at once
Must read