[R] if-else function
Laetitia Schmid
laetitia at gmt.su.se
Fri Aug 20 16:34:21 CEST 2010
Hi R people!
I am looking for some suggestions writing an if-else function.
The idea is to characterize different plots containing counts of
variables (here parasites). If a plot has a count equal or higher than
4 for any parasite the function should return a 1 else a 0. Later I
can loop the function over all plots.
Here I have a little subset of my data:
VariablePAR Plot1 Plot2
Plot3 Plot4
ParasiteA 3 1 1 4
ParasiteB 1 2 3 5
ParasiteC 2 1 1 3
ParasiteD 2 1 1 4
ParasiteE 4 1 1 1
The function should give a 1 for plots 1 and 4 and a 0 for plots 2 and
3.
Your help is very much appreciated,
Laetitia
More information about the R-help
mailing list