-1

Importing a .csv file into R using read.csv (with stringsAsFactors = FALSE)

One field is numeric (integers between 0 and 10) but has quite a lot of blanks in it.

read.csv gives me a data frame with this field as an int column, but with blanks tagged as NA. That's ok. But...I wanted a quick line of code to show me the unique values appearing in this field (including NA) so I used:

levels(as.factor(dataframe$fieldname))

but it doesn't include the NA entries in there, just the 1-10.

Is there another way to do this, so that I don't miss the NA entries?

user213544
  • 2,046
  • 3
  • 22
  • 52
Alan
  • 619
  • 6
  • 19

1 Answers1

1

You can use

unique(dataframe$fieldname)
user213544
  • 2,046
  • 3
  • 22
  • 52