I've got a data file A with 7 columns, no missing values, to which I've unix-joined a data file B that has 28 fields. The result file is C. If no match is found in B, then the output row in C only has 7 columns. If there is a match in B, then the output row in C has 35 columns. I've kicked around join's -e option to fill the missings 28 filds, but without success.
What I'm trying to do is duplicate SAS's MISSOVER input statement in R. For example the following code works perfectly:
 dat <- textConnection('x1,x2,x3,x4
 1,2,"present","present"
 3,4
 5,6')
 df <- read.csv(dat, sep=',' , header=T , 
     colClasses = c("numeric" , "numeric", "character", "character"))
 > df
   x1 x2      x3      x4
 1  1  2 present present
 2  3  4                
 3  5  6   
But when I try to load my C file, I get the following error (using TRUE instead of T):
 df <- read.table( 'C.tab' , header=T , sep='\t', fill=TRUE,
                   colClasses = c(rep('numeric',7),rep('character',28)))
 Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  : 
   line 1 did not have 35 elements
The first line (second row in C, after the header), does indeed have only those 7 fields from A. In SAS I'd use the MISSOVER statement to set all those trailing missing fields to some missing value. How can I do that in R? Thanks.
 
    