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) | |
library(rtweet) | |
library(glue) | |
tml <- get_timelines("JeffisTallguy", n = 200) | |
yesterday <- tml %>% | |
filter(is.na(reply_to_screen_name)) %>% | |
slice( | |
which(str_detect(text, "Yesterday by the Beatles is a pretty solid song")): |
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
--- | |
output: learnr::tutorial | |
runtime: shiny_prerendered | |
--- | |
```{r setup, include=FALSE} | |
library(learnr) | |
``` | |
## Exercise with Hint |
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) | |
packageVersion("dplyr") | |
library(lubridate) | |
library(glue) | |
set.seed(1234) | |
children <- tribble( |
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(rtweet) | |
library(tidyverse) | |
library(glue) | |
rt <- get_timeline( | |
user = "@NYT_first_said", | |
n = 18000 | |
) | |
rt <- rt %>% |
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
# theme options based on hour of day ------------------------------------------- | |
# based on https://github.com/rstudio/rstudio/issues/1579 | |
setHook("rstudio.sessionInit", function(chooseTheme) { | |
if (chooseTheme) { | |
if (as.numeric(format(as.POSIXct(Sys.time(), format = "%H:%M:%S"), "%H")) %in% c(0:5, 21:23)) { | |
if (rstudioapi::getThemeInfo()$editor != "Solarized Dark") rstudioapi::applyTheme("Solarized Dark") | |
} else { | |
if (rstudioapi::getThemeInfo()$editor != "Solarized Light") rstudioapi::applyTheme("Solarized Light") | |
} | |
} |
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
# data source ------------------------------------------------------------------ | |
# Are federal laws on gun ownership too strict? Not strict enough? Or just about right? | |
# http://www.surveyusa.com/client/PollReport.aspx?g=e2893631-b41f-40e1-a049-86e0849670ce | |
# load packages ---------------------------------------------------------------- | |
library(tidyverse) | |
# frequency table -------------------------------------------------------------- | |
freq_table <- tribble( |
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(rintrojs) | |
ui <- fluidPage( | |
introjsUI(), # Must include UI | |
titlePanel("Hello Shiny!"), | |
sidebarLayout( | |
sidebarPanel( | |
sliderInput(inputId = "bins", |
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
# load packages ---------------------------------------------------------------- | |
library(tidyverse) | |
library(patchwork) | |
# m ---------------------------------------------------------------------------- | |
m_df <- tribble( | |
~column, ~height, | |
"h1", 50, |
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(tidyr) | |
library(dplyr, warn.conflicts = FALSE) | |
library(purrr) | |
x <- tibble( | |
v1 = list(NULL), | |
v2 = list("something"), | |
v3 = list(NULL) | |
) |