I apologize because I thought there would be a very obvious answer, but I can not find anything on the net ...
I often get very large datasets where missing values are empty, for example. (shortly speaking)
I would like to replace all spaces, e.g. -999. If I use a reading table so that
dat = read.table('file.txt',skip=2)
I get an error
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : line 6 did not have 5 elements
I could open the file as a data frame and do
dat = data.frame('file.txt',skip=2) is.na(rad1) = which(rad1 == '')
but I don’t know if this will work, because I don’t know how to skip the top 2 lines when reading the data frame (for example, the equivalent of “skip”), and I could not find the answer anywhere. Can anyone help?
Thanks.
source share