The open source R programing language is a free software environment for statistical computing and graphics, and is easy to master. The official website is https://www.r-project.org/ . It can run on a wide variety of UNIX platforms, Windows and MacOS.
On September 24, 2016, this blog site published an article on how to use R to generate random numbers (https://consultglp.com/2016/09/24/how-to-use-r-to-generate-random-numbers/) . In light of the newly revised ISO/IEC 17025 accreditation standards embracing sampling as another important criterion for technical competence assessment, the random number function of R becomes very handy for cargo surveyors and samplers to prepare their sampling plan on cargo shipment.
We can use the random number function of R to create a random number table to suit the needs in randomly selecting samples for laboratory quality analysis.
For example, there is a shipment of 1000 bags of coffee beans in a warehouse to be surveyed prior to be dispatched to port. The buyer requires a 5% sampling for laboratory quality testing. That means some 50 bags have to be random selected before composite a portion of each bag into a suitable sized test sample through a quartering sub-sampling process.
The sampling plan, therefore, can be the following process:
1. Label each bag with a sequential number
2. Create 50 numbers in a random number table with the R command language:
> RandSampling=sample(500,50)
> dim(RandSampling)=c(10,5)
> RandSampling
[,1] [,2] [,3] [,4] [,5]
[1,] 154 424 84 486 82
[2,] 78 214 275 498 388
[3,] 93 104 478 148 258
[4,] 229 283 96 479 489
[5,] 487 211 216 59 263
[6,] 94 450 47 201 105
[7,] 330 121 130 276 56
[8,] 11 415 303 240 407
[9,] 427 60 71 142 409
[10,] 101 238 228 441 355
>
3. Sample a portion (say, 500g) of the coffee beans from the bags with these selected numbers into a large sampling bag.
4. Conduct a sample quartering process on site to reduce the test sample size to about 2.5 kg before sending to the laboratory for analysis.
Leave a Reply