问题
I have one csv file in which one column is character-type. Few values of that variable are NA (string). But when I am reading csv file in R using read.csv(), the "NA" strings are stored as NA. How can I fix it?
回答1:
You can use the na.strings argument in read.csv:
read.csv("myfile.csv", na.strings = "NNN")
回答2:
Not sure what you are asking really, but a pseudo use could be something such as:
if (null == column)
{
column = "NA";
}
来源:https://stackoverflow.com/questions/33126182/how-to-use-na-as-string