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
# the example code provided by RStudio to use R for word2vec has an error if you don't have enough data. | |
# This fixes the error by having the generator reset when it runs out | |
skipgrams_generator <- function(text, tokenizer, window_size, negative_samples) { | |
gen <- texts_to_sequences_generator(tokenizer, sample(text)) | |
function() { | |
next_value <- generator_next(gen) | |
if(is.null(next_value)){ #if there isn't new text from the generator | |
gen <<- texts_to_sequences_generator(tokenizer, sample(text)) # remake the generator | |
next_value <- generator_next(gen) |
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(dplyr) | |
library(ggplot2) | |
library(babynames) | |
size <- 25 | |
colors <- c("F" = "#DE94AF", "M" = "#6C939F", "X" = "#D4C62A") | |
ui <- fluidPage( | |
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
# start from the rocker/r-ver:3.5.0 image | |
FROM rocker/r-ver:3.5.0 | |
# install the linux libraries needed for plumber | |
RUN apt-get update -qq && apt-get install -y \ | |
libssl-dev \ | |
libcurl4-gnutls-dev | |
# install plumber | |
RUN R -e "install.packages('plumber')" |
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) | |
# here is a table that spreads the way you'd want (with two rows): | |
tribble( | |
~a, ~b, ~c, | |
"a", "x", 3, | |
"a", "y", 2, | |
"b", "x", 4, | |
"b", "y", 7 |
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
# _____ __ __ | |
# |__ / / /__ ____ _____ ____ ____/ / | |
# /_ <______/ / _ \/ __ `/ __ `/ _ \/ __ / | |
# ___/ /_____/ / __/ /_/ / /_/ / __/ /_/ / | |
# /____/ /_/\___/\__, /\__, /\___/\__,_/ | |
# /____//____/ | |
# RTWEET + 3-LEGGED-AUTH DEMO | |
# This code demonstrates how to do 3-legged authentication for Twitter | |
# using the {rtweet} package. Based heavily on code from Michael Kearney and Calli Gross |
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
# _____ __ __ | |
# |__ / / /__ ____ _____ ____ ____/ / | |
# /_ <______/ / _ \/ __ `/ __ `/ _ \/ __ / | |
# ___/ /_____/ / __/ /_/ / /_/ / __/ /_/ / | |
# /____/ /_/\___/\__, /\__, /\___/\__,_/ | |
# /____//____/ | |
# 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. |
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
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 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 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 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) |
OlderNewer