Kanika Singhal
Kanika Singhal

Reputation: 655

how to use "NA" as string

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?

Upvotes: 5

Views: 7766

Answers (1)

jeremycg
jeremycg

Reputation: 24945

You can use the na.strings argument in read.csv:

read.csv("myfile.csv", na.strings = "NNN")

Upvotes: 9

Related Questions