Exercise 16: Handling CSV files
Explore how to handle CSV files in R by reading grocery list data from a CSV, processing it, and writing selected information to a new CSV file. This lesson helps you understand file input/output operations crucial for data management in R.
We'll cover the following...
We'll cover the following...
Problem Statement
Using data from the file data.csv that contains a grocery list. This list contains the details of each item:
Structure of data.csv file
You have to fetch this data in your program and output just the list of items in a file out/outData.csv
Input
A file named data.csv that contains the grocery list.
Output
A file name output/outData.csv containing a list of the items only.
Sample Input
data.csv
Item, Price, Quantity
Apple, $10, 20
Banana, $5, 12
Mango, $17, 18
Sample Output
output/outData.csv
Apple
Banana
Mango
Test Yourself
Write your code in the given area. If you get stuck, you can look at the solution.