[R] Filling Empty Column with String in read.table

Gundala Viswanath gundalav at gmail.com
Thu Sep 17 08:33:49 CEST 2009


I have a data file that looks like this.

__DATA__
D7KAR5Z02F447V  176 G   0.22
D7KAR5Z02J3WLG  94  A   1.05    29
D7KAR5Z02F4K6L  198 a   0.13
D7KAR5Z02J4SYO  67  C   0.95    28
D7KAR5Z02J4SYO  83  C   1.01    29
D7KAR5Z02J4SYO  97  T   0.13
D7KAR5Z02J4SYO  166 A   0.94    27


I want the rows where the last column has no-entry to be filled
with "-".

Is there a way to do it with read.table?
I don't find any option to do it with read.table.

This only fill the empty 5th column with blank.

dat <- read.table("myfile.txt",na.strings="-",header=FALSE,fill=T);

G.V.




More information about the R-help mailing list