Using read.csv, empty fields have NA added to data.frame
I am using read.csv to import a file that contains some columns with empty cells. I need these cells to remain empty and not contain any values.
However, an NA is getting added everytime I import开发者_如何学Python. I have tried variations of na.strings (like na.strings="NULL" or na.strings="") to no avail.
Is there a simple way to force the observations to remain empty?
Any advice is appreciated.
After the import, try this:
x[is.na(x)] <- c("") ## Refills NA with blank character.
This converts the column to character but if you already have mixed strings I imagine it already is.
加载中,请稍侯......
精彩评论