skip some rows in read.csv in R

后端 未结 3 1573
無奈伤痛
無奈伤痛 2020-12-03 11:14

I have a csv file which I read using the following function:

csvData <- read.csv(file=\"pf.csv\", colClasses=c(NA, NA,\"NULL\",NA,\"NULL\",NA,\"NULL\",\"         


        
3条回答
  •  半阙折子戏
    2020-12-03 11:55

    It is better to read all and subset later like suggested in the comment :

    csvData [!csvData$ticker %in% c('ADCT','ABT'),]
    

    EDIT

    You can use fread from data.table package for more efficient method to read your file.

    library(read.table)
    fread(file="pf.csv")
    

提交回复
热议问题