String "NA" converted to <NA>
I have a file csv
with country names and their iso-codes. This is how it looks:
"Name","Code"
"Afghanistan","AF"
"Albania","AL"
"Algeria","DZ"
"Namibia","NA"
I read it in data.frame
using the following code:
cc = read.csv("countries.csv", header=TRUE, stringsAsFactors=FALSE,
colClasses = c("character"))
This is what the data looks like:
Name Code
Afghanistan AF
Albania AL
Algeria DZ
Namibia <NA>
The string is "NA"
converted to <NA>
, although I am explicitly setting colClasses = c("character")
.
How do I get "NA"
to show how "NA"
in data.frame
?
+3
source to share