Specifying colClasses in the read.csv

前端 未结 7 1165
独厮守ぢ
独厮守ぢ 2020-11-27 10:37

I am trying to specify the colClasses options in the read.csv function in R. In my data, the first column \"time\" is basically a character vector

7条回答
  •  抹茶落季
    2020-11-27 11:18

    Assuming your 'time' column has at least one observation with a non-numeric character and all your other columns only have numbers, then 'read.csv's default will be to read in 'time' as a 'factor' and all the rest of the columns as 'numeric'. Therefore setting 'stringsAsFactors=F' will have the same result as setting the 'colClasses' manually i.e.,

    data <- read.csv('test.csv', stringsAsFactors=F)
    

提交回复
热议问题