[R] How do I assign boolean (o,1) values to a column?
Xenimes
acasusa at gmail.com
Tue May 24 15:46:11 CEST 2011
Thank you David and Steve,
Yes all this data are already in R and in csv files.
Sorry for not being clear.
I have this:
Codes1and3[1:5,c(1:5)]
Mark_2 pop Mark_1 Mark_3 age
1 P A1 139 alpha 2
2 P A1 140 alpha 2
3 P A1 141 gamma 2
4 S A1 142 gamma 2
5 S A1 143 alpha 2
6 T A2 144 alpha 2
7 T A2 145 alpha 2
I’m comparing Marks 1 and 3, then I need to know if the ones in Mark_2 in
the general table have 1 or more interactions with Mark 3. For example here
“P” appears in the same row than “alpha” and then in the same than “gamma”,
then there are 2 interactions, so in a Boolean code it should be 1 (more
than1 interaction).
The same for “S”. But “T” only interacts with “alpha”, that will make it
only one interaction = 0.
The next colum I need is Code 1 referent to code 3 and in this case it
should look like this:
Code 1_3
1 1
2 1
3 1
4 1
5 1
6 0
I have tried to count but, of course in this case it will always be one,
because they are linked in each row once, how can I consider the other rows?
--
View this message in context: http://r.789695.n4.nabble.com/How-do-I-assign-boolean-o-1-values-to-a-column-tp3544304p3547156.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list