## Statistical computing meets biodiversity conservation and natural resource management

#### What is new in the intrval R package?

An update (v 0.1-1) of the intrval package was recently published on CRAN. The package simplifies interval related logical operations (read more about the motivation in this post). So what is new in this version? Some of the inconsistencies in the 1st CRAN release have been cleaned up, and I have been pushed hard (see GitHub issue to implement all the 16 interval-to-interval operators. These operators define the open/closed nature of the lower/upper limits of the intervals on the left and right hand side of the o in the middle as in c(a1, b1) %[]o[]% c(a2, b2).

#### Relational operators for intervals with the intrval R package

I recently posted a piece about how to write and document special functions in R. I meant that as a prelude for the topic I am writing about in this post. Let me start at the beginning. The other day Dirk Eddelbuettel tweeted about the new release of the data.table package (v1.9.8). There were new features announced for joins based on %inrange% and %between%. That got me thinking: it would be really cool to generalize this idea for different intervals, for example as x %[]% c(a, b).

#### How to write and document %special% functions in R

I spend a considerable portion of my working hours with data processing where I often use the %in% R function as x %in% y. Whenever I need the negation of that, I used to write !(x %in% y). Not much of a hassle, but still, wouldn’t it be nicer to have x %notin% y instead? So I decided to code it for my mefa4 package that I maintain primarily to make my data munging time shorter and more efficient. Coding a %special% function was no big deal. But I had to do quite a bit of research and trial-error until I figured out the proper documentation. So here it goes.

#### Effects of industrial sectors on species abundance in Alberta

Transformation of native habitat by human activity is the main cause of global biodiversity loss. Humans have visibly transformed 27% of Alberta to date. The effects of these changes depend on the species, and the nature and extent of the human activities in question. Teasing apart these factors in a cumulative effects framework are of the focus of several initiatives and organizations in Alberta. The Alberta Biodiversity Monitoring Institute (ABMI) collects data and produces information that helps attributing the effects of human activities on species to different industrial sectors, or as we call them, sector effects.

As a testament to my obsession with progress bars in R, here is a quick investigation about the overhead cost of drawing a progress bar during computations in R. I compared several approaches including my pbapply and Hadley Wickham’s plyr.

#### How to add pbapply to R packages

As of today, there are 20 R packages that reverse depend/import/suggest (3/14/3) the pbapply package. Current and future package developers who decide to incorporate the progress bar using pbapply might want to customize the type and style of the progress bar in their packages to better suit the needs of certain functions or to create a distinctive look. Here is a quick guide to help in setting up and customizing the progress bar.

#### What is the cost of a progress bar in R?

The pbapply R package adds progress bar to vectorized functions, like lapply. A feature request regarding progress bar for parallel functions has been sitting at the development GitHub repository for a few months. More recently, the author of the pbmcapply package dropped a note about his implementation of forking functionality with progress bar for Unix/Linux computers, which got me thinking. How should we add progress bar to snow type clusters? Which led to more important questions: what is the real cost of the progress bar and how can we reduce overhead on process times?

### Publications

Pankratz, R. F., Haché, S., Sólymos, P., and Bayne, E. M., 2017. Advancing bird population monitoring with acoustic recording technologies. Avian Conservation and Ecology, xx:xx–xx. —  journal website.

Kisfali, M., Sólymos, P., Nagy, A., Rácz, I. A., Horváth, O. and Sramkó, G., 2017. A morphometric and molecular study of the genus Pseudopodisma (Orthoptera: Acrididae). Acta Zoologica Academiae Scientiarum Hungaricae, 63:293–307. —  journal website fulltext PDF.

Van Wilgenburg, S. L., Sólymos, P., Kardynal, K. J. and Frey, M. D., 2017. Paired sampling standardizes point count data from humans and acoustic recorders. Avian Conservation and Ecology, 12(1):13. —  journal website fulltext PDF.

Yip, D. A., Leston, L., Bayne, E. M., Sólymos, P. and Grover, A., 2017. Experimentally derived detection distances from audio recordings and human observers enable integrated analysis of point count data. Avian Conservation and Ecology, 12(1):11. —  journal website fulltext PDF.

Fehér, Z., Majoros, G., Ötvös, S., Bajomi, B., and Sólymos, P., 2017. Successful reintroduction of the endangered Black Nerite, Theodoxus prevostianus (C. Pfeiffer, 1828) (Mollusca: Gastropoda: Nertidae) in Hungary. Journal of Molluscan Studies, 83: 240–242. —  journal website fulltext PDF.