The intrval R package is lightweight (~11K), standalone (apart from importing from graphics, has exactly 0 non-base dependency), and it has a very narrow scope: it implements relational operators for intervals — very well aligned with the tiny manifesto. In this post we will explore the use of the package in two shiny apps with sliders.
It all started with this paper in Methods in Ecol. Evol. where we looked at detectability of many species. So we wanted to use life history traits to validate our results. But we had to cut the manuscript, and there was this leftover with some neat patterns, but without much focus. It took a few years, and the most positive peer-review experience ever, and the paper is now early view in Ecography. This post is a quick summary of the goodies stuffed inside the lhreg R package that makes the whole analysis reproducible, and provides some functions for similar PGLMM models.
A friend and colleague of mine, Péter Batáry has circulated news from Nature magazine about the EU freezing innovation funds to Bulgaria. The article had a figure about publication trends for Bulgaria, compared with Romania and Hungary. As I have blogged about such trends in ecology before (here and here), I felt the need to update my PVA models with two years worth of data from WoS.
The pbapply R package that adds progress bar to vectorized functions has been know to accumulate overhead when calling
parallel::mclapply with forking (see this post for more background on the issue). Strangely enough, a GitHub issue held the key to the solution that I am going to outline below. Long story short: forking is no longer expensive with pbapply, and as it turns out, it never was.
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
These operators define the open/closed nature of the lower/upper
limits of the intervals on the left and right hand side of the
in the middle as in
c(a1, b1) %o% c(a2, b2).
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
%between%. That got me thinking: it would be really cool to generalize this idea for different intervals, for example as
x %% c(a, b).
opticut: Likelihood based optimal partitioning for indicator species analysis
intrval: Relational operators for intervals
pbapply: Adding progress bar to '*apply' functions
vegan: Community ecology package
ResourceSelection: Resource selection (probability) functions for use-availability data
mefa4: Multivariate data handling with S4 classes and sparse matrices
detect: Analyzing wildlife data with detection error
dclone: Data cloning and MCMC tools for maximum likelihood methods
dcmle: Hierarchical models made easy with data cloning
PVAClone: Population viability analysis with data cloning
sharx: Models and data sets for the study of species-area relationships
mefa: Multivariate data handling in ecology and biogeography
Stralberg, D., Wang, X., Parisien, M.-A., Robinne, F.-N., Sólymos, P., Mahon, C. L., Nielsen, S. E., and Bayne, E. M., 2018. Wildfire-mediated vegetation change in boreal forests of Alberta, Canada. Ecosphere, 9(3): e02156. — journal website — fulltext PDF.
Sólymos, P., Matsuoka, S. M., Stralberg, D., Barker, N. K. S., and Bayne, E. M., 2018. Phylogeny and species traits predict bird detectability. Ecography, xx: xx–xx. — journal website —
lhreg R package.
Fehér, Z., Jaksch, K., Szekeres, M., Haring, E., Bamberger, S., Páll-Gergely, B., and Sólymos, P., 2018. Range-constrained co-occurrence simulation reveals little niche partitioning among rock-dwelling Montenegrina land snails (Gastropoda: Clausiliidae). Journal of Biogeography, xx: xx–xx. — journal website — fulltext PDF.
Pankratz, R. F., Haché, S., Sólymos, P., and Bayne, E. M., 2017. Potential benefits of augmenting road-based breeding bird surveys with autonomous recordings. Avian Conservation and Ecology, 12(2):18. — journal website — fulltext PDF.
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.