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: "test" | |
| output: html_vignette | |
| --- | |
| ```{r error=TRUE, comment = "#>", collapse = TRUE} | |
| x | |
| x() | |
| ``` |
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: "Lesson emojis" | |
| author: "Mine Çetinkaya-Rundel" | |
| date: "11/21/2018" | |
| output: | |
| html_document: | |
| highlight: pygments | |
| theme: cerulean | |
| --- |
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) | |
| # mutate ----------------------------------------------------------------------- | |
| iris %>% | |
| mutate( | |
| Sepal.Length_cat = ifelse(Sepal.Length < mean(Sepal.Length), "below mean", "at or above mean"), | |
| Sepal.Width_cat = ifelse(Sepal.Width < mean(Sepal.Width), "below mean", "at or above mean"), | |
| Petal.Length_cat = ifelse(Petal.Length < mean(Petal.Length), "below mean", "at or above mean"), | |
| Petal.Width_cat = ifelse(Petal.Width < mean(Petal.Width), "below mean", "at or above mean") | |
| ) %>% |
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
| # load packages ---------------------------------------------------------------- | |
| library(ggmap) # for geocoding cities, need v2.7 from https://github.com/dkahle/ggmap | |
| library(fields) # for finding distance between two points | |
| library(maps) # for world map | |
| library(geosphere) # for connecting dots | |
| # geocode cities lived --------------------------------------------------------- | |
| ist <- geocode("Istanbul, Turkey") | |
| nyc <- geocode("New York, NY, USA") | |
| lax <- geocode("Los Angeles, CA, USA") |
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
| # Load packages ---------------------------------------------------------------- | |
| library(shiny) | |
| library(shinythemes) | |
| library(ggplot2) | |
| library(dplyr) | |
| library(fiftystater) | |
| library(tools) | |
| library(mapproj) | |
| library(fontawesome) |
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) | |
| library(rtweet) | |
| library(glue) | |
| tml <- get_timelines("CostcoRiceBag", n = 3200) | |
| br <- tml %>% | |
| filter(is.na(reply_to_screen_name)) %>% | |
| slice( | |
| which(str_detect(text, "IS IT JUST ME")): |
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) | |
| # list col for age -------------------------------------------------- | |
| df_listcol <- tibble( | |
| age = list(30, 40, 50, 55, "65+") | |
| ) | |
| typeof(df_listcol$age) | |
| #> [1] "list" |
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
| # Fit model with parallel lines (main effects only) | |
| m_pr <- lm(log(price) ~ Surface + factor(artistliving), data = pp_Surf_lt_5000) | |
| ## Option 1 | |
| # Save regression coefficients in a tibble | |
| m_pr_coefs <- m_pr %>% | |
| tidy() %>% | |
| select(term, estimate) |
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(ggplot2) | |
| ## Pre-app calculations | |
| # Get the current day of the month | |
| dom <- 25 | |
| # Define the target for salespeople in our organization. | |
| salesTarget <- 15000 |
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(ggplot2) | |
| dataset <- diamonds | |
| ui <- pageWithSidebar( | |
| headerPanel("Diamonds Explorer"), | |
| sidebarPanel( |