This file contains 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
<script> | |
(function() { | |
var divHTML = document.querySelectorAll(".details-open"); | |
divHTML.forEach(function (el) { | |
var preNodes = el.getElementsByTagName("pre"); | |
var outputNode = preNodes[1]; | |
outputNode.outerHTML = "<details open class='output'><summary>Output</summary>" + outputNode.outerHTML + "</details>"; | |
}) | |
})(); | |
(function() { |
This file contains 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(tidyverse) | |
family <- list( | |
list( | |
"name" = "Bob", | |
"age" = 46, | |
"mother" = NA, | |
"father" = "Big Bob", | |
"siblings" = list(NA), | |
"children" = list("Tina", "Gene", "Louise"), |
This file contains 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(data.table) | |
library(keypress) | |
## Create the universe. Well, sort of. | |
dims <- c(49, 49) | |
universe <- CJ(x = seq(dims[1]), y = seq(dims[2]), k = 1, cell = FALSE) | |
universe[, cell := sample(c(FALSE, TRUE), prod(dims), TRUE)] | |
## Neighbourhood to consider for each cell | |
neighbours <- CJ(xd = -1:1, yd = -1:1, k = 1)[xd != 0 | yd != 0] |
This file contains 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) | |
library(shinydashboard) | |
# devtools::install_github("nik01010/dashboardthemes") | |
library(dashboardthemes) | |
library(tidyverse) | |
library(sf) | |
library(leaflet) | |
library(usmap) # us counties and states as table | |
library(leaflet) |
This file contains 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
makeActiveBinding("v", local({ | |
e <- NULL | |
count <- 1 | |
function(value) { | |
# increment or reinitialize counter | |
exec_env <- sys.frame(-1) | |
if(identical(e, exec_env)) { | |
count <<- count + 1 | |
} else { |
This file contains 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
# remotes::install_github("coolbutuseless/eventloop") | |
Pong <- R6::R6Class( | |
"pong", | |
public = list( | |
initialize = function(width=10, height=7, speed=0.02) { | |
require(grid) | |
private$width <- width | |
private$height <- height |
OlderNewer