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
#create a 'dial' chart with ggplot2 and ggforce | |
library(ggforce) | |
library(dplyr) | |
referral_data <- data.frame(state = factor(c("Referral Accepted", | |
"Referral Not accepted")), | |
amount = c(0.81, 0.19)) %>% | |
#caluclate segments start and end in radians | |
mutate(start = c(0, amount[1]/sum(amount) * 2 * pi), | |
end = c(start[2], 2 * pi)) |
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(ceramic) | |
library(tidyverse) | |
roi <- raster::extent(140, 150, -40, -30) | |
im <- cc_location(roi, zoom = 8) | |
raster::plotRGB(im) | |
melbs <- | |
ozmaps::abs_gccsa %>% | |
filter(NAME == "Greater Melbourne") %>% |
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
set.seed(2019) | |
sample <- data.frame(class = sample(letters,10, replace = FALSE), | |
v1 = rpois(10,10), | |
v2 = rpois(10, 30), | |
v3 = rpois(10, 60)) | |
sample %>% | |
mutate(rowsum = pmap_int( | |
select(., -class), | |
sum) | |
) %>% |
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(rlang) | |
f <- function(dat){ | |
print(as_name(enquo(dat))) | |
dat | |
} | |
f(mtcars) #works |
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(datasets) | |
library(dplyr) | |
groupvar <- "age" | |
groupvar <- sym(groupvar) | |
typeof(groupvar) | |
summ_var <- "circumference" | |
summ_var <- sym(summ_var) |
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(magick) | |
library(magrittr) | |
# source: https://iridescentides.tumblr.com/icons | |
links <- | |
c(chidi = "https://78.media.tumblr.com/cafe3dc5ce1536ef6a106de068396a9a/tumblr_p2lcr5Sj4F1tovxi6o4_1280.jpg", | |
janet = "https://78.media.tumblr.com/10923cdfd9b5b83934de7a8a34b038dd/tumblr_p2lcr5Sj4F1tovxi6o2_1280.jpg", | |
tahani = "https://78.media.tumblr.com/635551a2e49b75f6bd7ee19025ccafc7/tumblr_p2lcr5Sj4F1tovxi6o9_1280.jpg") |
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
if (interactive()) { | |
suppressMessages(require(devtools)) | |
options(Ncpus = 3) | |
suppressMessages(require(goodshirt)) | |
goodshirt::soul_squad() | |
cowsay::say(as.character(soul_squad()), | |
by = "random", | |
what_color = crayon::green$bold, | |
by_color = crayon::green$bold ) | |
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(bomrang) | |
load(system.file("extdata","current_stations_site_list.rda", package = "bomrang")) | |
stations_site_list %>% | |
filter(state == "VIC") %>% | |
filter(stringr::str_detect(name,"MELB")) | |
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
setup <- function() { | |
face = c("king", "queen", "jack", "ten", "nine", "eight", "seven", "six", | |
"five", "four", "three", "two", "ace") | |
suit = c("spades","clubs","hearts","diamonds") | |
value = 13:1 | |
DECK <- data.frame( face = rep(face, length(suit)) , | |
suit = rep(suit, each = length(face)), | |
value = value) |
NewerOlder