This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(rJava) | |
| library(NLP) | |
| library(openNLP) | |
| s <- "The UK has two weeks to clarify key issues or make concessions if progress is to be made in Brexit talks, the bloc's chief negotiator has said. | |
| Michel Barnier was speaking after meeting the Brexit secretary for talks on citizens' rights, the Irish border, and the UK's 'divorce bill'. | |
| David Davis said it was time for both sides 'to work to find solutions'. Before the talks, Theresa May said she wanted the UK's exit date set in law, and warned MPs not to block Brexit.Speaking at a press conference in Brussels, Mr Barnier suggested Britain would have to clarify its position in the next fortnight on what it would pay to settle its obligations to the EU if the talks were to have achieved 'sufficient progress' ahead of December's European Council meeting. | |
| 'It is just a matter of settling accounts as in any separation,' Mr Barnier said.Mr Barnier also said both sides had to work towards an 'objective interpretation' of Prime Minister Theresa May's pledge that no m |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(aframer) | |
| library(aextras) | |
| embed_aframe( | |
| a_scene( | |
| a_dependency(), | |
| aextras_dependency(), | |
| a_assets( | |
| a_primitive( | |
| "asset-item", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Essentially what I want is the unique combinations of a vector of factors/characters | |
| x <- LETTERS[1:5] | |
| # x is of length 5 | |
| # Therefore, according to Pascal's triangle | |
| # https://en.wikipedia.org/wiki/Pascal%27s_triangle | |
| # | |
| # (n * (n - 1)) / k | |
| k <- 2 | |
| n <- length(x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(echarts4r) | |
| # create viz | |
| e <- mtcars %>% | |
| e_charts(mpg) %>% | |
| e_scatter(qsec, wt) | |
| # save as html | |
| htmlwidgets::saveWidget(e, file = "echarts4r.html") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(DT) | |
| library(rvest) | |
| library(dplyr) | |
| library(shiny) | |
| library(purrr) | |
| library(tidytext) | |
| library(echarts4r) | |
| response <- httr::GET( | |
| "https://api.weforum.org/v1/articles?page%5Bnumber%5D=2&page%5Bsize%5D=100" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| df <- data.frame( | |
| x = LETTERS[1:5], | |
| y = runif(5, 1, 5), | |
| z = runif(5, 3, 7) | |
| ) | |
| # gather the variables | |
| df_gather <- df %>% tidyr::gather("group", "y_axis", y, z) | |
| # plot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(shiny) | |
| string <- "print('from string')" | |
| installExprFunction({print("from expression")}, "expr") | |
| ui <- fluidPage( | |
| verbatimTextOutput("string"), | |
| verbatimTextOutput("expression") | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(magrittr) | |
| db <- new.env(hash = TRUE) | |
| define_vars <- function(...){ | |
| assign("my_vars", ..., envir = db) | |
| } | |
| print_vars <- function(){ | |
| print( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ############# FUNCTIONS | |
| #' A ping function that returns an object of say `qualtricsDemands` | |
| #' @param ids Vector of survey ids | |
| demand_downloads <- function(ids){ | |
| # simulate ping | |
| pinged <- purrr::map(ids, function(x) sample(c("failure", "success"), 1)) | |
| # construct object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(echarts4r) | |
| flights <- read.csv( | |
| paste0("https://raw.githubusercontent.com/plotly/datasets/", | |
| "master/2011_february_aa_flight_paths.csv") | |
| ) | |
| flights <- flights %>% | |
| dplyr::mutate(width = scales::rescale(cnt, to = c(0, 5))) |
OlderNewer