We must first set our working directory to import data into the R programming environment using the setwd() function. We utilize the in-built method read.csv() to read a csv file, which returns the contents from the file as a data frame.