Dear all,

I have a dataset that looks like 

id  var1  var2  var4  var7  var8 
1    0.0   0.1    0.3    0.9    0.0    
2    0.4   0.6    0.0    0.0    0.2    
3    0.0   0.0    0.0    0.8    0.7    

Some columns are missed, for example, here the fourth (var3), sixth(var5)
and seventh (var6) columns. I want to first determine which columns are
missed in a huge dataset and then add the missed columns with the values of
zeros that looks like

id  var1  var2   var3  var4  var5  var6  var7  var8 
1    0.0   0.1     0.0    0.3   0.0    0.0   0.9    0.0    
2    0.4   0.6     0.0    0.0   0.0    0.0   0.0    0.2    
3    0.0   0.0     0.0    0.0   0.0    0.0   0.8    0.7    

Can anybody please help how to get this done? Thanks a lot in advance

Lisa

-- 
View this message in context: 
http://r.789695.n4.nabble.com/Add-columns-of-dataset-tp3071722p3071722.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to