Thursday, March 19, 2015

R : Adding column names to data

Sometimes you have a huge data with multiple fields and the data stored in your file is not marked with header information (i.e. column names).
To add column names to your data frame or matrix after it is read into a variable run the following command:

> CustColName <- c("time", "Age", "Surname", "Standard", "RollNo", "Name")
> colnames(StudData) <- CustColName

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...