Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
jrosell authored Dec 28, 2023
1 parent 6201693 commit 15534c5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions _targets.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ source("functions.R")


list(
tar_target(
targets_test,
test_read()
),
tar_target(
unemp_data,
get_data()
Expand Down
12 changes: 8 additions & 4 deletions functions.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
print("functions.R")

test_read <- function() {
raw <- readr::read_csv("https://raw.githubusercontent.com/b-rodrigues/modern_R/master/datasets/unemployment/unemp_2013.csv")
raw |> janitor::clean_names()
}
# clean_unemp() is a function inside a package I made. Because I don't want you to install
# the package if you're following along, I'm simply sourcing it:
clean_unemp <- function(unemp_data,
Expand Down Expand Up @@ -50,9 +55,8 @@ clean_unemp <- function(unemp_data,
clean_data <- function(x){
print("clean_data")
print(x)
x %>%
janitor::clean_names() %>%
print(n = Inf) %>%
x |>
janitor::clean_names() |>
mutate(level = case_when(
grepl("Grand-D.*", commune) ~ "Country",
grepl("Canton", commune) ~ "Canton",
Expand All @@ -64,7 +68,7 @@ clean_data <- function(x){
commune = ifelse(grepl("Grand-D.*", commune),
stringr::str_remove_all(commune, "Grand-Duche de "),
commune),
) %>%
) |>
select(year,
place_name = commune,
level,
Expand Down

0 comments on commit 15534c5

Please sign in to comment.