library(rsample)
library(tidyverse)
library(palmerpenguins)
data("penguins")
penguins %>%
count(species)
#> # A tibble: 3 x 2
#> species n
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(tidytext) | |
library(widyr) | |
library(igraph) | |
library(ggraph) | |
words_cooccur <- tidy_words %>% | |
group_by(word) %>% | |
filter(n() > 250) %>% | |
ungroup() %>% | |
pairwise_cor(word, Respondent, sort = TRUE, upper = FALSE) %>% |
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(tidytext) | |
dat <- tibble( | |
a = c("row1", "row1", "row2", "row2", "row2"), | |
b = c("col1", "col2", "col1", "col3", "col4"), | |
val = 1:5 | |
) | |
d <- cast_dtm(dat, a, b, val) |
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) | |
potus <- get_timeline("realDonaldTrump", n = 3200) | |
potus %>% | |
transmute(creation_date = as.Date(created_at), | |
text = str_remove_all(text, "https://t.co/[A-Za-z\\d]+"), | |
exclamations = str_extract_all(text, "\\!"), | |
exclamations = map_int(exclamations, length), |
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(tidylo) | |
library(babynames) | |
top_names <- babynames %>% | |
filter(year >= 1950, | |
year < 1990) %>% | |
mutate(decade = (year %/% 10) * 10, | |
decade = paste0(decade, "s")) %>% | |
group_by(decade) %>% |
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
## https://github.com/rfordatascience/tidytuesday/blob/master/data/2020/2020-06-23/readme.md | |
library(tidyverse) | |
library(bcmaps) | |
locations <- read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-06-23/locations.csv') | |
locations_sf <- locations %>% | |
select(animal_id, longitude, latitude) %>% | |
st_as_sf(coords = c("longitude", "latitude")) %>% | |
st_set_crs(4326) %>% | |
transform_bc_albers() |
library(tidymodels)
car_rec <- recipe(~ ., data = mtcars) %>%
step_normalize(disp, qsec)
car_prep <- prep(car_rec)
juice(car_prep)
#> # A tibble: 32 x 11
library(tidymodels)
centers <- tibble(
cluster = factor(1:3),
num_points = c(100, 150, 50), # number points in each cluster
x1 = c(5, 0, -3), # x1 coordinate of cluster center
x2 = c(-1, 1, -2) # x2 coordinate of cluster center
)
library(tidymodels)
data(ames)
set.seed(833961)
ames_split <- initial_split(ames, prob = 0.80, strata = Sale_Price)
ames_train <- training(ames_split)
ames_test <- testing(ames_split)
ames_rec <- recipe(Sale_Price ~ Neighborhood + Gr_Liv_Area + Year_Built + Bldg_Type,
library(tidyverse)
library(tidytext)
library(tidylo)
library(silgelib)
beyonce_lyrics <- read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-09-29/beyonce_lyrics.csv')
#> Parsed with column specification:
#> cols(
#> line = col_character(),