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
name | mpg | cyl | disp | hp | drat | wt | qsec | vs | am | gear | carb | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2021 WRX | 23 | 4 | 122 | 268 | NA | 3.341 | 14 | 1 | 1 | 6 | 0 | |
2021 WRX STI | 19 | 4 | 150 | 305 | NA | 3.451 | 14.2 | 1 | 1 | 6 | 0 | |
2018 WRX | 23 | 4 | 122 | 268 | NA | 3.269 | 14 | 1 | 0 | NA | 0 | |
2017 WRX Premium | 23 | 4 | 122 | 268 | NA | 3.34 | 14 | 1 | 0 | NA | 0 | |
2015 WRX | 24 | 4 | 122 | 268 | NA | 3.267 | 14 | 1 | 1 | 6 | 0 | |
2013 WRX Hatchback | 21 | 4 | 150 | 265 | NA | 3.208 | 13.9 | 1 | 1 | 5 | 0 | |
2009 WRX Premium | 21 | 4 | 150 | 265 | NA | 3.142 | 13.9 | 1 | 1 | 5 | 0 |
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
get_sunrise_sunset <- function(lat,long, date, tz){ | |
# tz is required to know when daylight savings happens | |
response <- httr::GET(glue::glue("https://api.sunrise-sunset.org/json?lat={lat}&lng={long}&date={date}&formatted=0")) | |
results <- httr::content(response)$results | |
results[["day_length"]] <- NULL | |
results <- lapply(results, function(x) as.POSIXct(x,format="%Y-%m-%dT%T",tz="UTC")) | |
results <- lapply(results, function(x) lubridate::with_tz(x, tzone = tz)) | |
results | |
} |
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) | |
library(jsonlite) | |
# we'll store received data in a local json file | |
write_json(list(), "data.json") | |
post_handler <- function(req, response) { | |
# we'll catch everything that's POST for this demo but you'll want to make | |
# sure you don't step on shiny's built-in POST handlers | |
# (I'm pretty sure this handler is called after shiny's handlers but :shrug:) |
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) | |
library(jsonlite) | |
# we'll store received data in a local json file | |
write_json(list(), "data.json") | |
post_handler <- function(req, response) { | |
# we'll catch everything that's POST for this demo but you'll want to make | |
# sure you don't step on shiny's built-in POST handlers | |
# (I'm pretty sure this handler is called after shiny's handlers but :shrug:) |
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
# Creating a Star Trek: Deep Space Nine Netflix analytics plot in R | |
# | |
# FONT SETUP INSTRUCTIONS | |
# Before running this you'll need to go to this website, | |
# download the Context Ultra Condensed font, then install it to your system. | |
# https://www.st-minutiae.com/resources/fonts/index.html | |
# | |
# You'll need to register the font by running extrafont::font_import(). | |
# I found that I had to manually import the ttf file--it wasn't picked up by reading the default | |
# directory. Instead I did running |
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(tidyverse) | |
wealth <- tibble( | |
name = c( | |
"Jeff Bezos", "Bill Gates", "Mark Zuckerberg", "Bernard Arnault", "Steve Ballmer", | |
"Larry Page", "Elon Musk", | |
"Sergey Brin", "Mukesh Ambani", "Warren Buffet" | |
), | |
worth = c(184, 115, 94.5, 90.8, 74.6, 72.4, 71.6, 69.7, 69.4, 68.6), | |
increase = c(0.65, 0.4, 0.18, -0.11, .36, .14, 1.53, .13, .19, -0.21) |
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
--- | |
title: "Side-by-side images" | |
author: "Jacqueline Nolis" | |
date: "4/21/2020" | |
output: html_document | |
--- | |
```{r setup, include=FALSE} | |
knitr::opts_chunk$set(echo = TRUE) | |
``` |
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(flametree) | |
library(brickr) | |
library(ggplot2) | |
library(png) | |
library(magrittr) | |
library(rayshader) | |
library(rtweet) | |
# CREATE TREE ------------------------------ | |
temp_file <- tempfile(fileext=".png") |
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
setHook("rstudio.sessionInit", function(chooseTheme) { | |
if (chooseTheme) { | |
lat <- 47.608013 | |
long <- -122.335167 | |
eighties_time <- FALSE | |
if(is.element("httr",rownames(installed.packages()))){ | |
response <- httr::GET(paste0("https://api.sunrise-sunset.org/json?formatted=0&lat=", lat, "&lng=", long)) | |
if(response$status_code == 200L){ | |
values <- httr::content(response) |
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
# _____ __ __ | |
# |__ / / /__ ____ _____ ____ ____/ / | |
# /_ <______/ / _ \/ __ `/ __ `/ _ \/ __ / | |
# ___/ /_____/ / __/ /_/ / /_/ / __/ /_/ / | |
# /____/ /_/\___/\__, /\__, /\___/\__,_/ | |
# /____//____/ | |
# RTWEET + 3-LEGGED-AUTH DEMO (LITE) | |
# This code demonstrates how to do 3-legged authentication for Twitter | |
# using the {rtweet} package. Based heavily on code from Michael Kearney. |