Articles by A.M. Barbosa

Getting marine polygon maps in R

February 5, 2024 | A.M. Barbosa

Another frequent question of my students is how to obtain a polygon map of the seas and oceans, rather than the land polygons (countries, etc.) that are commonly imported with R spatial data packages. You can mostly just use the … Continue reading →
[Read more...]

Actual pixel sizes of unprojected raster maps

January 23, 2024 | A.M. Barbosa

It is well known, though often dismissed, that the areas of spatial units (cells, pixels) based on unprojected coordinates (longitude-latitude degrees, arc-minutes or arc-seconds) are wildly inconsistent across the globe. Towards the poles, as the longitude meridians approach each other, … Continue reading →
[Read more...]

Weighted probability vs. favourability

July 11, 2023 | A.M. Barbosa

Presence probability, typically obtained with presence-(pseudo)absence modelling methods like GLM, GAM, GBM or Random Forest, is conditional not only on the suitability of the environmental conditions, but also on the general prevalence (proportion of presences) of the species in the … Continue reading →
[Read more...]

Removing absences from GBIF datasets

April 17, 2023 | A.M. Barbosa

I often come across GBIF users who are unaware that the records available for a given taxon are not necessarily all presences: there’s a column named “occurrenceStatus” whose value can be “PRESENT” or “ABSENT”! The absence records can, of course, … Continue reading →
[Read more...]

Getting continent, mainland and island maps in R

March 8, 2023 | A.M. Barbosa

Maps of continents, mainlands and islands can be useful, for example, for selecting areas — and then cropping or masking variables — for modelling a species’ distribution. Here’s a way to obtain such maps using the ‘geodata’ and ‘terra’ R … Continue reading →
[Read more...]

Safe-and-simple cleaning of species occurrences

January 25, 2023 | A.M. Barbosa

In my species distribution modelling courses, for a quick and safe removal of the most common biodiversity database errors, I’ve so far used functions from the scrubr R package, namely ‘coord_incomplete’, ‘coord_impossible’, ‘coord_unlikely’, ‘coord_imprecise’ and ‘coord_uncertain’. There are other R … Continue reading →
[Read more...]

Lollipop chart

January 5, 2023 | A.M. Barbosa

According to modern recommendations in data viz, lollipop charts are generally a better alternative to bar charts, as they reduce the visual distortion caused by the length of the bars, making it easier to compare the values. So, in the … Continue reading →
[Read more...]

Degree-minute-second to decimal coordinates

February 2, 2022 | A.M. Barbosa

The ‘dms2dec’ function, posted here a while ago to convert longitude-latitude coordinates from degree-minute-second to decimal format, has recently been updated to accomodate more cases that I and my course participants run into. The function is pasted below and is … Continue reading → [Read more...]

Package modEvA 3.0 is now on CRAN!

December 21, 2021 | A.M. Barbosa

This version of R package “model Evaluation and Analysis” includes some bug fixes (thanks to Huijie Qiao, Ying-Ju Tessa Chen, Oswald van Ginkel and Alba Estrada), some new functions (predPlot, confusionLabel, and mod2obspred, which is now used internally by several … Continue reading →
[Read more...]

Mapping the confusion matrix

November 10, 2021 | A.M. Barbosa

The ‘confusionLabel‘ function below labels the predictions of a binary response model according to their confusion matrix categories, i.e., it classifies each prediction into a false positive, false negative, true positive or true negative, given a user-defined threshold value: Usage … Continue reading →
[Read more...]

Downloading and cleaning GBIF data with R

March 22, 2021 | A.M. Barbosa

Many students and workshop participants ask me for a (semi-)automated way to 1) download species occurrence data from GBIF into R, and 2) clean such data from common errors. The following script does that, while calling the user’s attention to … Continue reading → [Read more...]

Plot predicted values for presences vs. absences

January 20, 2021 | A.M. Barbosa

Diagnostic plots are always a nice, visually explicit way to assess our data and predictions, and I’ve just added a new one to the modEvA R package. The ‘predPlot‘ function plots predicted values separated into observed presences and absences, and … Continue reading →
[Read more...]

Functions for time tracking and management

June 26, 2020 | A.M. Barbosa

Especially since I had to start working as a freelancer, it became essential to keep an accurate record of how much time I spend on each task and project. I checked out some software tools available online (namely TimeCamp, which … Continue reading →
[Read more...]

Plot outliers and their values

March 13, 2020 | A.M. Barbosa

The ‘plot_outliers‘ function below draws a boxplot and a scatterplot of a numeric variable x and plots the values of the outliers (currently not offset, even if they overlap). For relatively small datasets, it can be a quick way to … Continue reading →
[Read more...]

fuzzySim updated to 3.0 on CRAN!

February 11, 2020 | A.M. Barbosa

The newest version of R package fuzzySim (3.0) is now on CRAN! It includes new functions such as ‘favClass‘, ‘bioThreat‘ and ‘gridRecords‘; improvements to some functions, help files and examples; updated e-mail and citation information [ see citation(“fuzzySim”) ]; clarifications … Continue reading →
[Read more...]

This blog is now on R-bloggers!

February 9, 2020 | A.M. Barbosa

I should have done this long ago, but it’s never too late: modTools has finally been added to R-bloggers — a content aggregator contributed by bloggers who write about R, empowering bloggers to empower other R users. I hope the … Continue reading → [Read more...]

Grid point occurrence records onto a raster

February 3, 2020 | A.M. Barbosa

The ‘gridRecords‘ function, which has just been added to the ‘fuzzySim‘ package (from version 2.6 on), takes a raster stack and a set of spatial coordinates of a species’ presence (and optionally absence) records, and returns a data frame with … Continue reading →
[Read more...]
1 2

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)