Tuesday, February 10, 2015

R : Reading data from CSV file

To read data from a csv file, you can use the use the read.table function in R:

> myData <- read.table("C:/Downloads/R_Tutorial/18MarchStudentInfo.csv", header=TRUE, sep=",")
The above command assumes your csv file has a header field at the begining of the file describing the column names. If your CSV does not contain a row describing the column names you can use it as :

> mydata <- read.table("C:/Downloads/R_Tutorial/18MarchStudentInfo.csv", header=FALSE, sep=",")
Change sep field appropriately depending on your column delimiter in your CSV

No comments:

Section 80C TMT 2023(PA) – Standard Deduction amounting to a maximum of Rs 8670 under IT rule

With the recently concluded Tax filing season (which if I may draw parallel to the Christmas holiday season enjoyed by one and all), Indians...