Skip to content
Prev 243884 / 398506 Next

Add columns of dataset

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