[R] convert table

giovanni bacaro bacaro at unisi.it
Mon Dec 17 18:03:34 CET 2007


Dear R user, a very simple question:
I have a table like this:

coor	v1	v2	v3
x1	12	33	123	
x2	1	123
x3	12	
x4	33	1

and I'd like to tranform this matrix in presence/absence data.frame

coor	1	12	33	123
x1	0	1	1	1	
x2	1	0	0	1
x3	0	1	0	0	
x4	1	0	1	0

Could you suggest me a direct way to do this?
Thank you
Giovanni



More information about the R-help mailing list