Reading and Writing CSV Files in R
📖 Scenario: You work in a small shop and keep track of your sales data in a CSV file. You want to load this data into R, make some changes, and then save the updated data back to a new CSV file.
🎯 Goal: Learn how to use read.csv to load data from a CSV file and write.csv to save data back to a CSV file in R.
📋 What You'll Learn
Create a CSV file named
sales.csv with given dataUse
read.csv to load the CSV file into a variableAdd a new column to the data frame
Use
write.csv to save the updated data to a new CSV file💡 Why This Matters
🌍 Real World
CSV files are a common way to store and share data like sales, inventory, or survey results. Being able to read and write CSV files lets you work with data easily in R.
💼 Career
Many jobs in data analysis, business, and science require handling CSV files. Knowing how to use read.csv and write.csv is a basic but important skill.
Progress0 / 4 steps