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

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to