How to debug your package in a {rhub} fedora container before sending to CRAN?

It is not the first time I present how to debug on an other platform before sending your package to CRAN. This time, before submission {checkhelper} failed on ‘fedora’ image provided by {rhub}. How to debug your package using this platform when your using an other OS? Let’s speak about docker and …

Read more

Share your R work following good dev practices from a single notebook

You write R scripts and you would like to share them with other users, in a sustainable and maintainable way. You already write your code in a notebook (Rmarkdown or Quarto) and share its HTML output. You would like to document the chunks, and make this documentation visible in a separate HTML page. …

Read more

Add {tmap} point layer with multiple symbol border colors and width

It’s been a while since my last blog post. Indeed, my free time is used to improve packages like “{fusen}: Inflate your package from a simple flat Rmd” , “{attachment}: Tools to deal with dependencies in scripts, Rmd and packages” or “{gitlabr}: An R client for the GitLab API”. Hence, drawing some …

Read more

I do not have time (to practice)

I’d really like to be able to do this, and I know I will benefit from it, but I do not have time or I did not find time to try it… […] How much time do you plan to take to read this blog post? Will you read until the end? Completely or the headlines only? […] If you do not have time …

Read more

Debug your package that failed on CRAN with {rhub}

If you sent packages on CRAN, you may have encountered some fails on different operating systems configurations that you never heard about before: Solaris, debian clang, fedora gcc, … Package {rhub} allows to test your package on some of them, prior to sending to CRAN. But, how to debug directly on …

Read more

How to debug your package on Win-Builder before sending to CRAN?

CRAN submission can be difficult as your package is checked on multiple OS and R versions that you may not be able to check yourself locally. Thankfully, some services like {rhub} and Win-Builder prevent some unfortunate CRAN errors. But how to debug code that is run on an external server, without …

Read more

Date-time Conversion in R with format and strptime

Each time I want to extract or show a specific attribute of a date or a time, I am lost in the documentation. What letter do I need to use in format() to get the name of the day written in full, in my language, from the current date? Is it “%Y %m %d”, “%a %b %d”, …? So let’s keep it short this time! …

Read more

Buffer areas for nearest neighbours or national marine areas delineation

A few weeks ago, Christina Buelow asked on Twitter how she could create the polygons of coastal waters using the land polygons, and making sure there is no overlap in buffer areas. This would make it possible to know which land area is closest to any place in the sea. Let’s explore what solution …

Read more

#30DayMapChallenge: 30 days building maps (3) - Earth is spherical

The #30DayMapChallenge was initiated by Topi Tjukanov on Twitter. This is open to anyone who would like to show a map, whatever the software is. In this blog post, I will show maps made with R. I add constraints to myself for fun. This week, I will create maps that remind map makers that Earth is …

Read more

#30DayMapChallenge: 30 days building maps (2) - tmap

The #30DayMapChallenge was initiated by Topi Tjukanov on Twitter. This is open to anyone who would like to show a map, whatever the software is. In this blog post, I will show maps made with R. I add constraints to myself for fun. This week, I will use {tmap} to create maps. This follows previous …

Read more

Follow moving particle trajectory over raster with {rayshader}

{rayshader} is a fantastic package for 3D mapping, but it comes with the limitations of {rgl}. I always found it a shame not being able to travel in all directions over my 3D objects. In this blog post, I will show a trick to simulate particle trajectory in 3 dimensions like in a “first person” …

Read more

Create a twitter bot on a Raspberry Pi 3 using R

With Marion Louveaux, we decided that we had to build a Twitter bot for our preferred hashtag. We explored different possibilities but truth is I couldn’t resist building it using R and {rtweet}. Here are the steps I used to set up a Twitter bot on my Raspberry Pi. […] I use package {rtweet} …

Read more

Keep a github/gitlab fork up-to-date

Developers in the R-community are open to any kind of help in the development of their packages. You can open issues but also propose some pull/merge requests to improve code and/or documentation. But once you have forked the main repository, how can you be sure to work on the last version of the …

Read more

Render mesh3d objects with rayshader and rayrender

People like to show 3D images in their presentations because it usually impresses the audience. Does it really ? I do not care ! I am just looking for an opportunity to play with some 3D images… This blog post is a detailed version of some 3D images shown during my presentation “Everything but maps …

Read more

Kaggle survey 2018: Maps of programming languages used and repartition of reproducibility issues

Last year I participated to the Kaggle survey data challenge. The challenge objective: tell a data story about a subset of the data science community represented in this survey, through a combination of both narrative text and data exploration. I used this opportunity to build ternary choropleth …

Read more

Play with spatial tools on 3D cells images

Let’s play with mapping tools on non-maps data ! {rayshader} is nice on raster maps, but what about using it on segmentized plant cell? […] I wanted to find a good reason to play with Tyler Morgan-Wall packages for 3D visualisation of raster data: {rayshader} and {rayfocus}. Using cell …

Read more

Introduction to mapping with {sf} & Co.

At the “Rencontres R 2018” in Rennes, I proposed a brief introduction to mapping using the recent {sf} package and some other interesting packages. This blog post is an extended version of my presentation allowing me to share the code of the different maps that appeared on it. It’s still a brief …

Read more

Draw maps like paintings

On the Grrr Slack, a mutual-aid Slack on R for French speaking people, Thomas Vroylandt showed the following maps asking how this could be done using {ggplot2} : EDIT : This maps was originally presented on visionscarto.net with drawings by Agnès Stienne […] As of today (2018-04-18): …

Read more

Spatial correlation between rasters

In this blog article, I propose a way to look at the spatial repartition of correlation between two rasters. For your own reason, you may want to know the correlation between rasters, but a unique value issued from fonction cor is not enough. You would like to know if there are variations of …

Read more

Spatial interpolation on Earth as a 3D sphere

Earth map is usually presented flat. Geographical coordinates usually go from -180° to +180°. Spatial interpolations using coordinates may be tricky as -180° is equal to +180°. Here I propose a way to realize spatial interpolations on Earth as a sphere and then map the outputs in 3D using rgl. The …

Read more

SDMSelect: Cross-validation model selection and species distribution mapping

This library has originally been created for covariates selection to predict species distribution (biomass, density or presence/absence). Its final aim is thus to produce maps of predicted distributions (Look at vignette SDM_Selection). However, the core of the library is a N-times k-fold …

Read more

Polygons tint band with leaflet and simple feature (library sf)

Let’s use some French regions polygons and attribute one colour to each region. I like piratepal colours of library yarrr. […] To create the doughnuts using original and buffer polygons, I used st_difference. However as discussed with edzer in the sf github repository, I had to transform the …

Read more

Rmarkdown conditional chunks to create multilingual pdf and html with images

In the upper output files, I list some of the tips I have to use to make this work and some bonus: […] I will modify this list if I face new difficulties or I find better ways to do things. […] The complete list of tips can be seen on the following web pages (embedded in iframes). Rmd …

Read more

Rshiny expert image comparison app

The expert image comparison was long: 40min for the small analysis and 3h for the complete one. As the shinyapp is freely hosted on the Rstudio shinyapps.io servers, it was not possible to save outputs of a specific session on the server. Thus, the web application has been built such that the …

Read more

A nice RShiny On/Off switch button

[…] This Rshiny ‘SwitchButton’ function allows to use nice on/off (or True/False) switch buttons instead of the default Rshiny ‘checkboxInput’ function. This only uses CSS code and does not make use of javascript. The ‘switchButton’ function includes two options: […] Steps to include …

Read more

Bayesian life cycle model: OpenBUGS code

The OpenBUGS code presented below is the additional material of a publication. This is the life cycle model of a marine species (the sole in the Eastern Channel). The Bayesian hierarchical model incorporates indices of juvenile spatialized abundance, larval dispersion, adult abundance indices and …

Read more