Solution Review: Handling CSV file
In this review, we provide a detailed analysis of the solution to the problem.
We'll cover the following...
We'll cover the following...
Solution: Input/Output from File
R
Files
path <- "data.csv"csvData = read.csv(path)items <- csvData$Itemwrite.csv(items, "output/outData.csv")
Explanation
In the code snippet above, we first fetch the data of the .csv file in csvData.
The data fetched from
read.csv()is directly in the format of a data frame. Therefore,csvDatais a data frame. Now, we can excess one of the columnsItemusing the syntax:
csvData$Item
We store this column in the variable items and then write on file output/outData.csv.