Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View smach's full-sized avatar

Sharon Machlis smach

View GitHub Profile
library(sf)
library(tigris)
library(tidycensus)
library(tidyverse)
library(mapview)
library(mapboxapi)
library(randomNames)
options(tigris_use_cache = TRUE)
denton <- counties(cb = TRUE) %>%
<?php
use Illuminate\Console\Command;
use Pgvector\Laravel\Vector;
use OpenAI\Laravel\Facades\OpenAI;
use App\Models\Document;
class AskQuestion extends Command
{
protected $signature = 'app:ask-question';
<?php
use Pgvector\Laravel\Vector;
use Illuminate\Console\Command;
use App\Models\Document;
use App\Models\Post;
use OpenAI\Laravel\Facades\OpenAI;
class ProcessPosts extends Command {
library(mapboxapi)
library(tidyverse)
library(sf)
library(patchwork)
city_halls <- c(
"New York" = "City Hall Park, New York, NY 10007",
"Los Angeles" = "200 N Spring St, Los Angeles, CA 90012",
"Chicago" = "121 N La Salle St, Chicago, IL 60602",
"Houston" = "901 Bagby St, Houston, TX 77002",
library(tidycensus)
library(tidyverse)
sysfonts::font_add_google("Roboto")
var <- "DP03_0025"
commute19 <- get_acs(
geography = "place",
variables = var,
survey = "acs1",
#### ---------------------------------------------
## Edit via: RStudio > Tools > Edit Code Snippets
# Released under a MIT license
snippet fragment
[${1:text}]{.${2:type}}
snippet aside
[${1:text}]{.aside}
@pedrocoutinhosilva
pedrocoutinhosilva / References
Last active April 4, 2023 18:25
Masterclass: Top Innovations in Shiny in 2022 - Pedro Silva
Social
github.com/pedrocoutinhosilva
linkedin.com/in/pedrocoutinhosilva
twitter.com/sparktuga
www.pedrocsilva.com
Examples
https://appsilon.com/journey-from-basic-prototype-to-production-ready-shiny-dashboard/
http://uaborder.com/
https://appsilon.com/is-it-possible-to-build-a-video-game-in-r-shiny/
@elliottmorris
elliottmorris / election_night_live_model.R
Last active January 29, 2024 18:56
A live election-night prediction model using The Economist's pre-election forecast
#' Description
#' This file runs a live election-night forecast based on The Economist's pre-election forecasting model
#' available at projects.economist.com/us-2020-forecast/president.
#' It is resampling model based on https://pkremp.github.io/update_prob.html.
#' This script does not input any real election results! You will have to enter your picks/constraints manually (scroll to the bottom of the script).
#'
#' Licence
#' This software is published by *[The Economist](https://www.economist.com)* under the [MIT licence](https://opensource.org/licenses/MIT). The data generated by *The Economist* are available under the [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/).
#' The licences include only the data and the software authored by *The Economist*, and do not cover any *Economist* content or third-party data or content made available using the software. More information about licensing, syndication and the copyright of *Economist* content can be fou
library(reactable)
library(dplyr)
red_pal <- function(x) rgb(colorRamp(c("#FFCDD2FF", "#C62828FF"))(x), maxColorValue = 255)
blue_pal <- function(x) rgb(colorRamp(c("#BBDEFBFF", "#1565C0FF"))(x), maxColorValue = 255)
mtcars %>%
select(cyl, mpg) %>%
reactable(
pagination = FALSE,
@anttilipp
anttilipp / Tdata.csv
Created May 19, 2020 18:13
Code and data to reproduce the temperature anomaly animation.
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 143 columns, instead of 43. in line 1.
Country,ISOA3,Continent,1880,1881,1882,1883,1884,1885,1886,1887,1888,1889,1890,1891,1892,1893,1894,1895,1896,1897,1898,1899,1900,1901,1902,1903,1904,1905,1906,1907,1908,1909,1910,1911,1912,1913,1914,1915,1916,1917,1918,1919,1920,1921,1922,1923,1924,1925,1926,1927,1928,1929,1930,1931,1932,1933,1934,1935,1936,1937,1938,1939,1940,1941,1942,1943,1944,1945,1946,1947,1948,1949,1950,1951,1952,1953,1954,1955,1956,1957,1958,1959,1960,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019
"Afghanistan","AFG","Asia",-0.325,-0.160,-0.814,-0.773,-0.971,-1.133,-1.123,-0.478,0.088,-0.679,-0.617,-1.107,-0.323,-0.914,-1.006,-0.286,-0.299,-0.759,-0.959,0.192,-0.560,-0.291,0.206,-1.049,-0.403,-0.859,-0.386,-0.973,-0.615,-0.069,-0.620,-0.842,-0.251,-0.432,0.256,0.886,-0.614,-0.067,-0.513,-0.38