What's the best way to replace missing values with NA when reading in a .csv?

后端 未结 2 1525
Happy的楠姐
Happy的楠姐 2020-12-24 09:51

I have a .csv dataset with many missing values, and I\'d like R to recognize them all the same way (the \"correct\" way) when I read the table in. I\'ve been using:

2条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-24 09:57

    You can also use the more flexible readr package, whose equivalent function and argument are read_csv() and na.

    library(readr)
    read_csv("file.csv", na = c(".", ".."))
    

提交回复
热议问题