When you have data in a CSV, you can load it into a data frame in R using
df <- read_csv('my_csv_file.csv')
read_csv()function is called
my_csv_file.csvis passed in as an argument
You can also save data from a data frame to a CSV using
In the example above,
write_csv() takes two arguments:
df, which represents a data frame object
new_csv_file.csv, the name of the CSV file that will hold the data from the data frame
By default, this method will save the CSV file to your current directory.
artists.csv contains data from the top 7 most popular music groups of 2018. Within the empty code block, load the CSV into a data frame
artists. On the line below, type
artists and run the code to view the rendered data frame.
Use the arrows to view the different columns of the data frame!