Entering edit mode
8.4 years ago
natasha
▴
110
Hi
I am new to R and would like to create a presence absence matrix for my gene data.
My data at the moment looks like this;
Isolate 1 2 3 4
Gene1 N/A Vp_2003 Vp_2003 Vp_2004
Gene2 Vp_4590 N/A N/A N/A
Gene3 Vp_3333 Vp_3333 Vp_3333 Vp_3333
....
I would like Vp values to be replaced with 1's and N/A to be replaced with 0's.
Many thanks
and
(mat != "N/A")*1
will get 0s and 1sThank you, this worked perfectly