read.csv() - two out of three columns

12,293

You can use the colClasses argument to skip columns:

mydata <- read.csv('mydata.csv', colClasses=c('NULL',NA,NA))

or

mydata <- read.csv('mydata.csv', colClasses=c('NULL', 'numeric', 'numeric'))
Share:
12,293
Admin
Author by

Admin

Updated on June 11, 2022

Comments

  • Admin
    Admin almost 2 years

    Possible Duplicate:
    Only read limited number of columns in R

    I have a ascii-dataset which consists of three columns, but only the last two are actual data. Now I want to dotchart the data by using read.csv(file = "result1", sep= " "). R reads all three columns. How do I avoid this?