The check_for_existence function looks at the folder that you are going to save your PDFs to and checks whether you have already got any of them. It then suggests that you filter to remove them.

check_for_existence(data, save_names = "save_names", dir = "heaps_of")

Arguments

data

A dataframe that contains URLs that you want to download and the names that you want to save them as.

save_names

The name of the column whose values should be the saved file names where the downloaded file will be saved, save_names by default.

dir

The directory to download files to, current working directory by default.

Value

The data dataframe with a column specifying whether the file has been downloaded.

Examples

if (FALSE) two_pdfs <- tibble::tibble( locations_are = c("https://osf.io/preprints/socarxiv/z4qg9/download", "https://osf.io/preprints/socarxiv/a29h8/download"), save_here = c("competing_effects_on_the_average_age_of_infant_death.pdf", "cesr_an_r_package_for_the_canadian_election_study.pdf") ) heapsofpapers::get_and_save( data = two_pdfs, links = "locations_are", save_names = "save_here" )
#> Error in is.data.frame(data): object 'two_pdfs' not found
heapsofpapers::check_for_existence(data = two_pdfs, save_names = "save_here")
#> The specified directory does not exist. Would you like it to be created? (Yes/no/cancel)
#> Error in dplyr::mutate(., save_names_full_path = fs::path(dir, .data[[save_names]])): object 'two_pdfs' not found