In read.table
(and its relatives) it is the na.strings
argument which specifies which strings are to be interpreted as missing values NA
. The default value is na.strings = "NA"
If missing values in an otherwise numeric variable column are coded as something else than "NA
", e.g. ".
" or "N/A
", these rows will be interpreted as character
, and then the whole column is converted to character
.
Thus, if your missing values are some else than "NA
", you need to specify them in na.strings
.