Skip to content

Commit

Permalink
no native pipe for now
Browse files Browse the repository at this point in the history
  • Loading branch information
beanumber committed Jul 6, 2022
1 parent d304d26 commit d8e7fa3
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions R/phenocam.R
Expand Up @@ -38,11 +38,11 @@ phenocam_read_day_urls <- function(x = Sys.Date()) {
"https://phenocam.nau.edu/webcam/browse/macleish/",
format(the_date, "%Y/%m/%d/")
)
url |>
url %>%
# need authentication to make this work!!
xml2::read_html() |>
rvest::html_elements("td") |>
rvest::html_elements("img") |>
xml2::read_html() %>%
rvest::html_elements("td") %>%
rvest::html_elements("img") %>%
rvest::html_attr("src")
}

Expand All @@ -60,11 +60,11 @@ phenocam_read_monthly_midday_urls <- function(x = Sys.Date()) {
"https://phenocam.nau.edu/webcam/browse/macleish/",
format(the_date, "%Y/%m/")
)
url |>
xml2::read_html() |>
rvest::html_elements("td") |>
rvest::html_elements("img") |>
rvest::html_attr("src") |>
url %>%
xml2::read_html() %>%
rvest::html_elements("td") %>%
rvest::html_elements("img") %>%
rvest::html_attr("src") %>%
stringr::str_subset("macleish")
}

Expand All @@ -80,8 +80,8 @@ phenocam_image_url_midday <- function(x = Sys.Date()) {
monthlies <- phenocam_read_monthly_midday_urls(x)
this_day <- format(as.Date(x), "%Y_%m_%d")

monthlies |>
stringr::str_subset(this_day) |>
monthlies %>%
stringr::str_subset(this_day) %>%
head(1)
}

Expand All @@ -94,7 +94,7 @@ phenocam_image_url_midday <- function(x = Sys.Date()) {
#' }

phenocam_info <- function() {
phenocamr::list_sites() |>
phenocamr::list_sites() %>%
dplyr::filter(site == "macleish")
}

Expand Down

0 comments on commit d8e7fa3

Please sign in to comment.