Importing Your Data

R Studio supports several file formats, including CSV, Excel, and text files.

To access your files, you can first set your “working directory,” or the folder you are working in.

setwd("C:/Users/Me/Folder")

You can import your data into R Studio using the read.csv() function Try it with your data!

data <- read.csv("filename.csv")
data <- read.csv("filename.csv", header=T)
data <- read.csv("filename.csv", stringsAsFactors=T)

Saving Data

Saving data:

write.csv(data, "filename.csv")
write.csv(data, file = file.choose())

The data can be anything, from a single number to large datasets. It will save to the current working directory is no filepath is provided:

write.csv(data, "filepath/filename.csv")