If your data is tab-delimited, you can use read.delim
. This should take care of missing values for you automatically.
If your data is space-delimited, you can use either read.delim(*, sep=" ")
or read.table(*, header=TRUE, sep=" ")
. Either one will read your data using spaces as delimiters, with multiple consecutive spaces indicating missing values. Looking at the extract you provided, you'll have to decide if Homo sapiens
is meant to be one field or two -- the latter is fine, but the former will be problematic if your data really is delimited by spaces.
Using read.delim(sep=" ")
on your data imported without a hitch though, so I'm guessing Homo sapiens
is meant to be two fields.
One way or the other, do read the documentation for your file. That's the only way to be sure what it contains.