search for: html_element

Displaying 1 result from an estimated 1 matches for "html_element".

Did you mean: htmlelement
2023 Jul 26
1
Downloading a directory of text files into R
...k. suppressPackageStartupMessages({ library(rvest) }) # destination directory, change this at will dest_dir <- "~/Temp" # first get the two subfolders from the Data webpage link <- "http://home.brisnet.org.au/~bgreen/Data/" page <- read_html(link) page %>% html_elements("a") %>% html_text() %>% grep("/$", ., value = TRUE) -> sub_folder # create relevant disk sub-directories, if # they do not exist yet for(subf in sub_folder) { d <- file.path(dest_dir, subf) if(!dir.exists(d)) { success <- dir.create(d) msg...