[R] First value in a row

Camilo Mora cmora at dal.ca
Tue Jul 24 08:48:56 CEST 2012


This is likely a trivial problem but have not found a solution.  
Imagine the following dataframe:

Lat   Lon  x1   x2  x3
01    10   NA   NA  .1
01    11   NA   .2  .3
01    12   .4   .5  .6

I want to generate another column that consist of the first value in  
each row from columns x1 to x3. That is


Any input greatly appreciated,



Camilo Mora, Ph.D.
Department of Geography, University of Hawaii

More information about the R-help mailing list