[R] question for if else
Aimin Yan
aiminy at iastate.edu
Fri Dec 8 22:23:16 CET 2006
I have a data set like this
I want to assign "outward" to Y if sc <90 and assign "inward" to Y if sc>=90.
then cbind(p1982,Y) to get like these
p aa as ms cur sc Y
1 154l_aa ARG 152.04 108.83 -0.1020140 92.10410 inward
2 154l_aa THR 15.86 28.32 0.2563560 103.67100 inward
3 154l_aa ASP 65.13 59.16 0.0312137 7.27311 outward
4 154l_aa CYS 57.20 49.85 -0.0549589 72.97930 outward
5 154l_aa TYR 28.87 31.75 0.0526457 96.11660 inward
6 154l_aa ASN 31.14 31.09 0.0632711 55.65980 outward
does anyone know how to these?
Aimin
> head(p1982)
p aa as ms cur sc
1 154l_aa ARG 152.04 108.83 -0.1020140 92.10410
2 154l_aa THR 15.86 28.32 0.2563560 103.67100
3 154l_aa ASP 65.13 59.16 0.0312137 7.27311
4 154l_aa CYS 57.20 49.85 -0.0549589 72.97930
5 154l_aa TYR 28.87 31.75 0.0526457 96.11660
6 154l_aa ASN 31.14 31.09 0.0632711 55.65980
More information about the R-help
mailing list