Você está na página 1de 17

MAYFEB Journal of Agricultural Science

Vol 1 (2016) - Pages 10-26

Using R Language for Statistical Computing for


Pesticide Application Calculations
Donyo H. Gacnhev, Agricultural University - Plovdiv, Bulgaria, donyo@abv.bg
Abstract- R language and environment for statistical computing is used in the agricultural science and practice not
only for conducting of the statistical analyses of the data but for performing specific calculations rapidly and securely.
Using and applying the pesticides in the agriculture is associated with making a lot of calculations and statistical analyses,
which guarantee the right and correct application of these chemical substances. There is many disadvangatages if such
kind calulations are performed by hand (in correct computing, time consuming, formulas and algorithms memorizing,
using complex and in most cases - expensive statistical software, etc.) and in order to be eliminated this disadvantages, so
called computer method is used as alternative which include creating and using specific calculators as freeware or
shareware software. Sometimes simple calculators are created as Excel worksheets / macros which approach have a lot of
disadvantages. With increasing popularity of the R language more and more scientists and specialists from agricultural
area spotted it as viable alternative and way of performing the necessity calculations for the application of the pesticides
and statistical manipulation of the data received from scientific trials.

I. INTRODUCTION

R is a language and environment for statistical computing and graphics. It is a GNU project which is similar to
the S language and environment which was developed at Bell Laboratories (formerly AT&T, now Lucent
Technologies) by John Chambers and colleagues R can be considered as a different implementation of S. There are
some important differences, but much code written for S runs unaltered under R. R was created by Ross Ihaka and
Robert Gentleman at the University of Auckland, New Zealand, and is currently developed by the R Development
Core Team [1].
During the last decade, the momentum coming from both academia and industry has lifted the R programming
language to become the single most important tool for computational statistics, visualization and data science.
Worldwide, millions of statisticians and data scientists use R to solve their most challenging problems in fields
ranging from computational biology to quantitative marketing. R has become the most popular language for data
science and an essential tool for Finance and analytics-driven companies such as Google, Facebook, and LinkedIn
The advantages of R are:

free and open-source

easy to be learn program language

a lot of specific objects as vectors, dataframes, lists which facilitate the manipulation of the data

different ways of entering the initial data - depending to the personal preferences of the given user or

specifications of the data

numerous build-in mathematical and statistical formulas

numerous (over 5000 !) additional packages with function and algorithms created by many people from

around the world cover almost every human and scientific areas

10

MAYFEB Journal of Agricultural Science


Vol 1 (2016) - Pages 10-26

enhanced plotting and graphic creation abilities

platform independent - can be run on Windows, Linux and Mac OS

During the recent years R gained increasing popularity in the agricultural science and practice not only for
conducting of the statistical analyses of the data but for performing specific calculations rapidly and securely.
Using and applying the pesticides in the agriculture is associated with making a lot of calculations, which
guarantee the right and correct application of these chemical substances. This task is critical and the most important
for utilization of the pesticides due the the fact that they are in most cases dangerous chemical substances as for
humans as for the environment. The famous postulate "Poison is in everything, and nothing is without poison. The
dosage makes it either a poison or a remedy" created by German-Swiss physician and alchemist Philippus Aureolus
Theophrastus Bombastus Von Hohenheim known also as Paracelsus, indicate a basic principle of toxicology and
pharmacy and respectively safety application of the toxic substances including the pesticides as in [2].
The using of the pesticides or Plant Protection Products (PPPs) in the agriculture and the necessity of performing
the correct calculations for their application is associated with several problems:

the risk of not effective pesticide application and / or contamination of the environment and poising of the

peoples who applied pesticides in case of incorrect calculations of the doses, concentrations and application rates

the fact that such kind calculations often are conducted quickly, in the field, just before the start of the PPP

application, with lack of comfortable conditions as common office environment which lead to increasing risk of
incorrect computations

the fact that most of the agricultural specialist (agronomist) as representatives of the natural sciences do

not have sufficient mathematical skills as engineers for example

the need of memorizing of specific formulas and algorithms which are critical for the right application of

the pesticides and evaluation of the results from pesticides treatments and uses

the need received results from pesticides treatments to be statistically manipulated. In most cases this

require using complex, expensive statistical software with steep learning curve.
Despite the fact that in the agricultural area, respectively applications of the pesticides the calculations are much
more simple that in the technical sciences area, the importance and the critical role of the correct performing
computations due the effectiveness of PPPs and safety of the environment of applicators impose the using different
computer and non-computer methods for elimination of the risk of conducting the wrong calculations.
The one of the major non-computer method for performing the correct pesticides calculations is by creating and
using so called "Calculation / Calibration Sheets" many available for free download as .pdf files from the sites of the
various scientific, government or advisory institutions in the agricultural area as in [3, 4, 5].
In this approach, the minimizing the mistake making is achieved by pointing step-by-step the necessity
calculations in the right order and clearly indentified formulas. Although, this is more accurate, it still requires
computing with calculator and paying attention on entering the initial values and computation with the calculator by
hand.
In order to be eliminated this disadvantages, so called computer method is used as alternative which include
creating and using specific calculators as freeware or shareware software as in [6, 7, 8, 9, 10,11, 12].

11

MAYFEB Journal of Agricultural Science


Vol 1 (2016) - Pages 10-26

Sometimes simple calculators are created as Excel worksheets /macros as in [13, 14, 15, 16]. However such kind
software have several disadvantages (some of which are typical also and for Calculation / Calibration Sheets) as:

Calculations or the order by which they must be performed are specified by the creator of the software or

sheet. This means that if given user (agronomist) have own preferred way or given pesticide or given conditions of
the use of the pesticide require different order or different calculations, such calculator (sheet) can't be used

Typical problem is when different measurement units (metric or imperial) are used. In some counties in

Eastern Europe like Bulgaria or Russia, the land area unit dekar is used than hectare as in the most of European
countries. Although there is a lot of freeware software available on internet for unit conversion, this will additionally
complicate and slow down the computational process and respectively - will increase the risk of making the wrong
calculations

Problems can be appear due the compatibility between different versions of the Ms. Excel or compatibility

between different versions of Ms. Windows

There is almost no such kind software for the Linux or Mac OS operational systems

Such kind of software, Excel worksheets /macros or calculation sheets request only single value entering

for each type calculation. This mean that in case of using more than one pesticide or spaying equipment or treating
different crops requiring different application techniques (field crops and orchards for example), the user must
repeat one calculation many times with different values. Therefore he/she must pay attention may times on the same
calculation for entering the initial values and after that - getting the received results. This problem is extremely
major in the pesticide screening process conducted as from specialists working for the companies which produced
plant protection products, as for specialists who are hired from the government intuitions for controlling the safety
registration and application of pesticides and respectively - for the scientists who conducted various scientific trials
with pesticides.
With increasing popularity of the R language more and more scientists and specialists from agricultural area
spotted it as viable alternative and way of performing the necessity for the application of the pesticides calculations
as in [17, 18, 19]. R language has several advantages over traditional paper calculation / calibration sheets or
standard software or excels templates / macros:

R programming language is very easy to be understood and learned. This mean that ever specialist who are

not very skilful in the area of mathematical and statistical analyses and data manipulation or in the IT development
can learn and handle with it for a very short time. For example, students who for the first time encounter with R
during their courses of "Phytopharmacy (Pesticide Science)" and "Ecotoxicology" in Agricultural University Plovdiv, Bulgaria, were able to create their own functions for pesticides calculations, just after one class (45
minutes) lectures. The presence of numerous build - in functions and specific objects in R like vectors and
dataframes facilitate this

Using R which is interpreter program language unlike software created by complied computer language

like C, C++, Pascal allow users to customize the way and the type of calculations according to their preferences or
according to the given pesticides or conditions of use. User also can specify the way of entering the initial data - as
console input, as build-in excel like editor, as file in csv format and so on

12

MAYFEB Journal of Agricultural Science


Vol 1 (2016) - Pages 10-26

R is platform independent which mean that scripts created with R can be run without any problems onto

various platforms

R is interpreter program language not complier - the "software" written in R is actually script file with

very compact size - in most cases between 4 and 40 KB

R is universal - this language can be used both for performing given area specific calculations and for

sophisticated and cutting -edge mathematical and statistical manipulation and analyses according to the top leading
standards

With R due to the specific objects like vectors and dataframes and ready to be used build-in functions and

algorithms, can be performed many calculations with same formula but with different values. This mean that the
user pay attention only on entering the initial values. Calculations are done by R and the final results can be copypaste or exported automatically in the various file formats

II. MATERIALS AND METHODS


R language for statistical computing was used (R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree") and
R Studio Integrated Development Environment for R language (Version 0.99.893 2009-2016 R Studio, Inc.) for
creation of calculation scripts and demonstrations [20].

II. RESULT AND DISCUSSIONS

The Fig. 1 below describe the source code of function created by R language for calculation of the amount of
pesticide needed according to the registered dose of use and given amount of application solution:

Figure 1. R language script for "pestcal" function

13

MAYFEB Journal of Agricultural Science


Vol 1 (2016) - Pages 10-26

The user full function (function with arguments) "pestcal" was created. The round () function was can be used in
order to be specify the accuracy of the final results. In the example, calculations were made on the base of litters as
amount of pesticide solution and kilograms as dose per dka of plant protection product (1 dka = 0.1 ha or 1000
square meters). Of course if the user wants, can use grams which in some cases are more comfortable. In this case
rarely in the agronomy practice precision as one or more digits after decimal marks is used i.e in most cases
agronomist work with whole numbers in expression and application of the amounts of pesticides. That's why, the
round function have 0 argument i.e function pestcal () return the amounts of the pesticides as whole numbers - Fig.
2:

Figure 2. R language script for "pestcal" function execution


Such kind of function can be created as "empty function" i.e function without arguments - Fig. 3:

Figure 3. R language script for "pestcal" function with arguments

14

MAYFEB Journal of Agricultural Science


Vol 1 (2016) - Pages 10-26

In this case via print() function, messages for the user can be appeared on the screen. The user input can be get via
function scan(). Of course, R language allow many values to be entered simultaneously - Fig. 4:

Figure 4. R language script for "pestcal" function with arguments execution


The given function can be also modify with using the internal editor of the R for entering the initial data and
saving them as dataframe -Fig. 5 and Fig. 6:

Figure 5. R language script for "pestcal" function with internal data editor

15

MAYFEB Journal of Agricultural Science


Vol 1 (2016) - Pages 10-26

Figure 6. R language script for "pestcal" function with internal data editor execution
The presented figures (examples) illustrated the numerous possibility of R language even in the calculation of
something so simple as the percent concentration of plant protection products. Extremely simple and elementary
programming, with various ways of entering the initial data and expressing the final results

can be used, plus

ability multiple initial data to be entered simultaneously. Although, the presented algorithm is very simple, its
practical application require a need of memorizing given formula and a need such king calculations to be performed
very quickly and the most important - very correctly. Any mistake in the calculations can lead literally to the failure
of given pesticide treatment, which can cause a lot of economic losses of the given farm (or farmer)
The created function can be saves as R workspace (RData file) which will have approximately 4 Kb size and can
be stored without any problems on any storage device or send by e-mail or Skype and can be opened on any
machine and operational system where R language interpreter is installed.
Another example of possibilities of R language in the area of for pesticides application calculations is when
orchard trees have to be sprayed. In this case agronomist must perform several calculations in order to determine the
amount of pesticide solution needed for uniformly covering the plants and respectively plant's crowns and dose of
the plant protection products registered on base of given amount cubic meters canopy - TRV algorithm [21, 22].
(plant's crowns) - Fig. 7:

16

MAYFEB Journal of Agricultural Science


Vol 1 (2016) - Pages 10-26

Figure 7. R language script for TRV calculation


The illustrated example - Fig. 7 show the creation of full user function (function with arguments). For more clear
initial data inputs and coping with the function comments with # mark can be done. The results of the execution of
the function are expressed in Fig. 8:

Figure 8. R language script for TRV calculation execution

17

MAYFEB Journal of Agricultural Science


Vol 1 (2016) - Pages 10-26

The typical example of calculation in the agricultural area are so called "fractional calculations" or calculations for
different kind of recipes (for pesticides, forages, and so on). Such kind recipes can include two, three, four or more
components and performing the necessity calculations can be quite confusing and boring for agronomists or farmers.
Fig. 9 illustrate creation of R language calculator for such kind calculations:

Figure 9. R language calculator for fractional calculations


In this case, calculations are performed in grams, however the script easily can be modified to perform
calculations in any measurement units.The action of the script is demonstrated on Fig. 10 for calculations of the so
called sulfur smoke mix which emit sulfur dioxide and is used in the large scale in pest managenet for fumigation of
the empty spaces against different storage pests (rodents, bacteria, fungi) [23, 24].

18

MAYFEB Journal of Agricultural Science


Vol 1 (2016) - Pages 10-26

Figure 10. R language calculator for fractional calculations for sulfur smoke mix
If given farmer need to make 5000 grams (5 kg) sulfur smoke mix - must take 2.5 kg ammonium nitrate, 1.5 kg
sulfur and 1 kg timber dust.
Of course the presented R language script (calculator) can be modify very easily in order to perform only
calculations for the sulfur smoke mix. This from one hand can guarantee the right performing of the calculations and
from the other - will be no need given recipe to be memorized from the user or checked via textbook or internet. The
user (agronomist, farmer) simply have a handy calculator which can be started on the any device (operating system)
where R language IDE was installed, which calculator can perform the task very quickly, can calculate results from
many initial data simultaneously and can be modified anytime, anywhere.
The data received from pesticide effectiveness tests must be mathematically and statistically manipulated. Firstly
the percent effectiveness must be calculated according to the formulae of Henderson and Tilton [25].
Fig. 11 represent the created R language script for this formulae:

19

MAYFEB Journal of Agricultural Science


Vol 1 (2016) - Pages 10-26

Figure 11. The percent Effectiveness - Henderson and Tilton formulae


The result of the execution of the function is given on Fig.12:

Figure 12. The percent Effectiveness - Henderson and Tilton formulae - the result of execution

20

MAYFEB Journal of Agricultural Science


Vol 1 (2016) - Pages 10-26

Another example of the mathematical manipulation of the data received from pesticide trials is so called
"Apparent infection rate" [26, 27, 28]. which is an estimate of the rate of progress of a disease, based on
proportional measures of the extent of infection at different times. The formula is presented on Fig. 13:

Figure 13. Apparent infection rate formulae


Fig.14 show R language script for calculation of the - Apparent infection rate formulae:

Figure 14. Apparent infection rate, R language script


The result of the function is on the next Fig. 15:

Figure 15. Apparent infection rate, R language script execution

21

MAYFEB Journal of Agricultural Science


Vol 1 (2016) - Pages 10-26

And as was mentioned above, R allow many batch calculations to be made simultaneously and no need of
memorizing of the formula. The test design of the many trials require creation of matrix consisted from tested
variants (test plots) positioned in random order in the test field in some number of replicates. Fig. 16, show R
language script for creation of such kind test design:

Figure 16. R language script for test design function


The script also calculate the Degrees of Freedom [29, 30] . as necessity requirement for validation of the test - the
minimal value for such kind trials is 12. The execution of the script is presented on the next Fig. 17:

Figure 17. R language script execution for test design function


The next exapmle (Fig. 18), show the user function for automaitically manipulation of data from pesticide
effectiveness test according to One-Way ANOVA (Analysis of Variance) [31].:

22

MAYFEB Journal of Agricultural Science


Vol 1 (2016) - Pages 10-26

Figure 18. R language One - way ANOVA analyses


As is shown, this is an empty function which start the ANOVA and allow user to enter the initial data in the buildin excel like graphical editor. The function execute ANOVA analysis of the test via aov () function and show the
results. After that, Tukey () function perform the ANOVA analysis between tested variants in the test and show the
results. Via function plot() graphics from the test are automatically created and are ready to be inserted into report,
printed, copied, etc - Fig. 19 and Fig. 20:

23

MAYFEB Journal of Agricultural Science


Vol 1 (2016) - Pages 10-26

Figure 19. R language One - way ANOVA analyses graphs

24

MAYFEB Journal of Agricultural Science


Vol 1 (2016) - Pages 10-26

Figure 20. Figure 19. R language One - way ANOVA analyses graphs

III. Concussion
The presented examples show the power and application of the R language for pesticides calculations and
statistical analysis. The multiplatform IDE, easy to learn and understand programming language with various
facilitations as dataframes and vectors and

numerous additional packages with function and algorithms, make it

viable alternative of the commercial software and Microsoft Excel macros. The multiplatform integrated
development environment with low system requirements allow created scripts (calculators) to be run anytime,
anywhere. The scripts can be very quickly modified according to the given conditions and / or personal preferences.

25

MAYFEB Journal of Agricultural Science


Vol 1 (2016) - Pages 10-26

[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
[9]
[10]
[11]
[12]
[13]
[14]
[15]
[16]
[17]

[18]
[19]
[20]
[21]
[22]
[23]
[24]
[25]
[26]
[27]
[28]
[29]
[30]
[31]

REFERENCES
R Core Team. (2015). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria.
Available at: https://www.R-project.org/
Toxpedia. (2013). Paracelsus. Available at:http://www.toxipedia.org/display/toxipedia/Paracelsus
Montana State University Extension. (2009). Calibrating Ground SprayersUsing Shortcut Methods. Available at:
http://store.msuextension.org/publications/AgandNaturalResources/MT200915AG.pdf.
S.Zedaker, and T. Nichols, Calibrating Hand-Held and Backpack Sprayers for Applying Pesticides, VCE Publication,1986, pp. 456-502
University
of
Vermont.
(2009).
Examples
of
Pesticide
Use
Calculations
.
Available
at:
http://www.uvm.edu/pss/pd/pdc/pestcertexamreview404/calculation.pdf
J.P. Walklate, and V. J. Cross, A webpage calculator for dose rate adjustment of orchard spraying products, Aspects of Applied Biology,
2010 No. 99 pp. 359-366
T. Fangling, and T. Shirao, A Calculator for Getting the Optimal Mixture Ratio of Insecticides, Journal of Biomathematics. 1996-S1
CSGNetwork.com.
(2016).
Liquid
Pesticide
Volume
Calculator
Version
1.0.2.
Available
at:
http://www.csgnetwork.com/pesticideliquidcalc.html
FarmLogic. (2014). Tank Mix Calculator. Available at: https://www.farmlogic.com/farmlogic_products/tank-mix-calculator/
OMAFRA. (1997). OMAFRA Sprayer Calibration Calculator. Available at: http://www.omafra.gov.on.ca/english/crops/sprayer/ep75.htm.
DuPont. (2010). TankMix By DuPont. Available at:https://itunes.apple.com/us/app/tankmix/id348144450?mt=8
Orange
Enterprises,
Inc.
(2010).
The
Spray
Calculator.
Available
at:
http://www.orangesoftware.com/software/tigerjill/features/calculator.html
L. Xia, L. Yonggui, and Y. Dangping, Application of EXCEL in Calculating of Toxicity for Pesticide Bioassay, Chinese Agricultural
Science Bulletin, 2009-19
L. Ai, T. Lidi, and M. Ou-yang, Application method to calculate toxicological test with Excel, Chinese Journal of Vector Biology and
Control, 2000 Vol. 11 No. 1 pp. 43-47
Nursery Industry Pesticide Management Diary and Best Management Practice Guidelines.(2013). Calibration Sheet. Available at:
https://www.ngia.com.au/Folder?Action=View%20File&Folder_id=135&File=FINAL_NGI_Pesticide_Diary_DEC2013.xls
A. Arakaki. (2003). Sprayer calibration template. Available at:http://www.ctahr.hawaii.edu/oc/freepubs/spreads/spraycal.xls
D. Shivling, G. Amarendra, C. Ghanshyam, K. Sharma, D. Arora, S. Kumar, and R. Kumar, A real time computational and statistical
model (with high availability) of early warning for plant protection and pest control for crops (exp. Kutki), 2015 IEEE International
Conference on Computer Graphics, Vision and Information Security (CGVIS), 2-3 Nov. 2015, pp. 22 - 26, ISBN: 978-1-4673-7436-1,
DOI:10.1109/CGVIS.2015.7449886
W. Pavan, C. Fraisse, and N. Peres, Development of a web-based disease forecasting system for strawberries, Computers and Electronics
in Agriculture, 2011, Volume 75, Issue 1, pp 169175
S. Parafiniuk, and J. Tarasinska, Work simulation of the sprayer field beam with the use of R program, Journal of Central European
Agriculture, 2013, 14(3), p.166-175
S. Zheng, B. Chen, X. Qiu, M. Chen, Zh. Ma, and X. Yu, Distribution and risk assessment of 82 pesticides in Jiulong River and estuary in
South China, Chemosphere Volume 144, February 2016, pp 11771192
J. Regg, and O. Viret, Determination of the tree row volume in stone-fruit orchards as a tool for adapting the spray dosage,
EPPO
Bulletin, 1999, 29: 95101. doi: 10.1111/j.1365- 2338.1999.tb00802.x
A. Miranda-Fuentesa, J. Llorensa, A. Rodrguez-Lizanab, A. Cuencaa, E. Gilc, G. Blanco-Roldna, and J. Gil-Ribesa, Assessing the
optimal liquid volume to be sprayed on isolated olive trees according to their canopy volume, . Science of The Total Environment, 2016
Volume 568, pp 296305
J. Auger, S. Ferarys, and J. Huignard, A possible new class of natural sulfur pesticides for fumigation, Congrs Europen d'cologie,
1992, No6, Marseille , FRANCE (07/09/1992), 1994, vol. 25, no 2 (1 p. ref.), pp. 93-101
B. M.Green, S.G. Hartley, and F. T. West, Chemicals for crop improvement and pest management, 1987 pp. ix + 370 pp
F. C.Henderson, and E. W. Tilton, Tests with acaricides against the brow wheat mite, J. Econ. Entomol, 1955, 48:157-161
W. Parry, Plant pathology in agriculture, Cambridge University Press, 1990, pp. 6667. ISBN 0-521-36890-1
R. Rodrigues, J. Pedrini, C. Fraisse, J. Fernandes, F. Justino, A. Heinemann, L. Costa, and F. Ribeiro do Vale, Utilization of the cropgrosoybean model to estimate yield loss caused by Asian rust in cultivars with different cycle, Bragantia, 2012, vol.71 no.2
http://dx.doi.org/10.1590/S0006-87052012000200021
A. Kushalappa, and A. Lugwig, Calculation of Apparent Infection Rate in Plant Diseases: Development of a Method to Correct for Host
Growth, Phytopathology, 1982, 72:1373-1377
Bulletin OEPP/EPPO Bulletin. (2012). Design and analysis of efficacy evaluation trials. 42 (3), 367381. ISSN 0250-8052. DOI:
10.1111/epp.2610
J. Rabinovich, E.Nieves, and L. Chaves, Age-specific mortality analysis of the dry forest kissing bug, Rhodnius neglectus, Entomologia
Experimentalis et Applicata, 2010, Volume 135, Issue 3, pp 252262
R. Heiberger, and B. Holland, Statistical Analysis and Data Display. An Intermediate Course with Examples in R, Springer Texts in
Statistics, 2015, ISBN: 978-1-4939-2121-8 (Print) 978-1-4939-2122-5

26

Você também pode gostar