Skip to content

Instantly share code, notes, and snippets.

View giocomai's full-sized avatar

Giorgio Comai giocomai

View GitHub Profile
library(sf)
library(dplyr)
library(ggplot2)
library(gganimate) # needs development version from github
# helper function to place a geometric object at a desired position
# and scale
place_geometry <- function(geometry, position, scale = 1) {
(geometry - st_centroid(geometry)) * scale +
st_sfc(st_point(position))
@AdamSpannbauer
AdamSpannbauer / wordcloud2_clickeven_with_reset.R
Created January 12, 2018 19:15
wordcloud2 example of click event and input resetting
#current preferred version of wc2
devtools::install_github("Lchiffon/wordcloud2#32")
#function to give wordcloud2 click interactivity
wc2ClickedWord = function(cloudOutputId, inputId) {
#ARGUMENTS
# - cloudOutputId: string; outputId of wordcloud2 obj being rendered (should be identical to the value passed to wordcloud2Output)
# - inputId: string; inputId of word clicked on (ie you will reference in server the word by input$inputId)
#OUPUT
# - referencing input in server will return a string of form word:freq (same as hover info shown in wordcloud; ie 'super:32')
@giocomai
giocomai / udunits in Fedora.R
Created June 14, 2017 15:03
install udunits2 for R in Fedora
# sudo dnf install udunits2 udunits2-devel
install.packages("udunits2", configure.args = c(udunits2 = '--with-udunits2-include=/usr/include/udunits2'))