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) | |
oms_db <- | |
tribble( ~id, ~data, ~start, ~end, | |
1, 1, '2020-01-01', '2020-01-04', | |
1, 2, '2020-01-04', '3000-01-01', | |
2, 1, '2020-01-01', '2020-01-04', | |
2, 2, '2020-01-04', '3000-01-01', |
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
x <- vignette("dbplyr") | |
rstudioapi::navigateToFile(with(x, file.path(Dir, "doc", File))) |
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) | |
first_year <- tibble(year = 2010, z = 1, x = 2, y = 3) | |
all_years <- first_year %>% | |
bind_rows(tibble(year = 2011:2015)) | |
all_years %>% | |
summarise( | |
year = year, |
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
some_praise <- quote(praise::praise()) | |
praise_fn_code <- bquote(function() { | |
.(some_praise) | |
}) | |
print(praise_fn_code) | |
#> function() { | |
#> praise::praise() | |
#> } |
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
{ | |
"fnmate::rs_fnmate": "Ctrl+Shift+F", | |
"drake::rs_addin_r_make": "Ctrl+M", | |
"drake::rs_addin_loadd": "Ctrl+L", | |
"shrtcts::shortcut_01": "Ctrl+P", | |
"shrtcts::shortcut_02": "Ctrl+O", | |
"shrtcts::shortcut_03": "Ctrl+T" | |
} |
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://milesmcbain.xyz/alt-r-with-vscode/ | |
https://sharla.party/post/comparing-two-dfs/ | |
https://themockup.blog/posts/2020-07-25-meta-rmarkdown/ |
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
## apply a function to square a list of numbers | |
square <- function(x) { | |
x^2 | |
} | |
lapply(list(1,2,3), square) | |
## save some code and declare 'square' anonymously - i.e. never assign it anywhere | |
## using the name 'square' |
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
``` r | |
library(tidyverse) | |
fruits <- tribble(~fruit, ~date, ~sold, | |
"Apple", "2020-06-23", 1, | |
"Apple", "2020-06-24", 2) %>% | |
mutate(fruit = fct_expand(fruit, "Banana")) | |
levels(fruits$fruit) | |
#> [1] "Apple" "Banana" |
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
``` r | |
library(tidyverse) | |
fruits <- tribble(~fruit, ~date, ~sold, | |
"Apple", "2020-06-23", 1, | |
"Apple", "2020-06-24", 2) %>% | |
mutate(fruit = fct_expand(fruit, "Banana")) | |
levels(fruits$fruit) | |
#> [1] "Apple" "Banana" |
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
deps_target_recursive <- function(target, plan){ | |
deps <- deps_target(target, plan = plan, character_only = TRUE) | |
target_itr <- function(deps, all_deps){ | |
new_deps <- | |
purrr::map_dfr(.x = deps$name, | |
.f = ~ drake:::deps_target_impl(.x, drake:::drake_config2(plan), character_only = TRUE)) %>% | |
distinct() |