# NOT RUN {
if (requireNamespace("xml2", quietly = TRUE) &
requireNamespace("rvest", quietly = TRUE)) {
res = httr::with_config(
config = httr::config(ssl_verifypeer = FALSE),
httr::GET("https://sleepdata.org/datasets/shhs/files/datasets")
)
doc = httr::content(res)
tab = rvest::html_table(doc)[[1]]
path = tab$X2
path = path[ grepl("shhs-data-dictionary-.*-domains", path)]
path = path[1]
path = paste0("datasets/", path)
} else {
path = "datasets/shhs-data-dictionary-0.14.0-domains.csv"
}
dataset = "shhs"
nsrr_download_url(dataset, path, token = "")
if (nsrr_have_token()) {
res = nsrr_download_file(dataset, path)
testthat::expect_true(res$success)
path = "biostatistics-with-r/shhs1.txt"
res = nsrr_download_file(dataset, path)
}
url = nsrr_download_url("shhs", path = "datasets/CHANGELOG.md",
token = NULL)
res = nsrr_download_file("shhs", path = "datasets/CHANGELOG.md",
token = NULL)
testthat::expect_true(res$correct_md5)
res = nsrr_download_file("shhs", path = "datasets/CHANGELOG.md",
token = NULL, check_md5 = FALSE)
testthat::expect_null(res$correct_md5)
# }
Run the code above in your browser using DataLab