I will be off for a few days…
I will be off for a few days…
I will be back in January… enjoy a nice winter break !
Mi-décembre, je serais (virtuellement) à Marseille pour donner un exposé au séminaire Big Data et Économétrie. A priori ça sera enregistré, et je mettrai la vidéo en ligne !
My kids have a very popular blog (at least among their grandmothers) where they frequently post pictures from everyday’s life (since they live 5000km from them), as well as pictures taken from holidays. This afternoon, I tried to used the popupImage function from the leaflet package to post pictures, on a map (to explain where we spent our holiday this summer). This post is just to keep tracks of that code.
First, we need to load the appropriate R packages
Then, we take a picture, and we locate it, for instance Mirror Lake (on the trail to Lake Agnes). Since leaflet uses openstreetmap, I recommend to use it also for location (and not google maps… coordinates can be slightly different)
df=data.frame(lat =51.41603, long=-116.23946, nom = "Miror Lake",photo="http://freakonometrics.free.fr/jaspeR/_DSC5967.jpg")
I guess you can also use the metadata if you take pictures with a cell phone, and you add the location… but I am (very) old fashioned, and still use a camera to take pictures. Then you can add a dozen pictures
df=rbind(df, data.frame(lat =51.4164, long=-116.2442, nom = "Lake Agnes",photo="http://freakonometrics.free.fr/jaspeR/_DSC6003.jpg")) df=rbind(df, data.frame(lat =51.3215642,long=-116.193718, nom="Moraine Lake",photo="http://freakonometrics.free.fr/jaspeR/_DSC5957.jpg"))
From that dataframe, we need two kinds of information: the location, and the url of the picture,
data_df=df[,c("lat","long")] images = as.character(df$photo)
Then we can create the leaflet map (sorry for typos, but wordpress converts the > symbol into some “>” characters… which makes R pipe operator hard to read)
m = leaflet(data_df) %>% addTiles() %>% addCircleMarkers( fillOpacity = 0.8, radius = 5, lng = ~long, lat =~lat, popup = popupImage(images) )
and export it (in a nice html file)
library(htmlwidgets) saveWidget(m, file="jaspR.html")
Time for a break ! So guess what ? The blog will be off during a few days… See you in August !
This week, I was supposed be in Ottawa, at Carleton, for Canadian Statistical Society Conference… I organized a nice session on predictive modeling, and I was supposed to present our recent work on insurance and genealogical data. The paper is will be online soon.
Tonight, I will leave London, UK, to go to Brussels, for the Actuarial and Financial Mathematics Conference…
Tonight, I will be on my way to Imperial College, in London, to finalize our 2020 actuarial pricing game… More to come soon, on the blog !
(and yes, it’s London, UK, not London, Ontario… where the 6th Workshop on Insurance Mathematics will be organized at the end of the week)
Monday, at lunch time, I will be giving at talk at the seminar in ESSEC, on actuarial pricing in a competitive market.
After my visit in Waterloo, I will flight directly from Toronto to Paris, where I will spend (almost) the week.
I will spend the end of the week in Waterloo, Ontario. I will give a talk Friday afternoon, on actuarial pricing in a competitive market.
After my talk, I will go to Chicago for the week-end…