0
votes

Reading in a text file that has 6 columns and varying number of rows with read.table. The last couple lines sometimes have missing data except for the 3rd column. When I use fill=TRUE to fill in the missing data it bumps the values from column 3 to the 1st column. How do I get the data to remain in column 3, but still replace other cells with NA?

1
Works for me. Seriously, though: numerous things could go wrong. You need to give us an example of your table, like the first 10 lines of the file if you want anyone to help you. Make sure that the first 10 lines demonstrate your problem, though.January

1 Answers

1
votes

If you just want to replace the missing values with NA you should use na.strings = "".

eg.:

read.table(file, na.strings = "")