Specifying colClasses in the read.csv

前端 未结 7 1167
独厮守ぢ
独厮守ぢ 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:15

    I know OP asked about the utils::read.csv function, but let me provide an answer for these that come here searching how to do it using readr::read_csv from the tidyverse.

    read_csv ("test.csv", col_names=FALSE, col_types = cols (.default = "c", time = "i"))
    

    This should set the default type for all columns as character, while time would be parsed as integer.

提交回复
热议问题