4
votes

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
What does the csv file use to indicate missing values?Pierre L
I don't understand what is the problem you facing. Please provide a MWEDavid Arenburg
@Pierre Lafortune, they are just blank in csv fileKanika Singhal
Blank can mean " " or "" to new users. Whichever it is, add that to jeremy's answer as na.strings=" " or na.strings="".Pierre L
yeah it is a god idea thanksKanika Singhal

1 Answers

8
votes

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

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