Mapdeck is leaving R

So long, and thanks for all the fish

The time has come to remove mapdeck from R. And it's all because of this tweet

I must admit, my first impression was awesome, look what people are already doing with it

But then this sentence stood out like a spreadsheet in a directory of data

rendered in about a minute

I know the tweeter had good intentions, but it struck a chord with me. It's not good enough. So I'm taking mapdeck out of R.

Where's it going?

To C++ of course!

Those of you who have followed my recent packages, particularly colourvalues, googlePolylines and geojsonsf will have probably seen this coming. And thanks to the awesome Rcpp package by Eddelbuettel et al (seriously, I can't recommend it highly enough) this is made 'fairly' straightforward.

Do you really get much speed improvement?

The benchmarks are promising, down from 71 seconds to 4. Yes, FOUR seconds! I'd call that a win.

n <- 1e6
df <- data.frame(
    id = 1:n
    , lon = sample(-180:180, size = n, replace = T)
    , lat = sample(-90:90, size = n, replace = T)
    , polyline = sample(letters, size = n, replace = T)
    , r = 1:n
    , s = rnorm(n)
    , stringsAsFactors = F
)

library(microbenchmark)

microbenchmark(
    old = { old <- add_scatterplot( ... ) },
    new = { new <- add_scatterplot2( ... ) },
    times = 5
)

# Unit: seconds
# expr       min        lq      mean    median        uq       max neval
#  old 71.439725 71.945582 74.644004 73.121869 76.494151 80.218691     5
#  new  4.018393  4.277548  4.302488  4.295433  4.350198  4.570869     5

I've omitted the actual code from this post because it's still very much in pre-alpha, but you get the idea. And you'll have to trust me they produce the same map.

Awesome! When can I use it?

No idea. I haven't set myself a deadline yet, but I'll keep this blog updated with ... updates... (has to be a different word?).