Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(httr)
- library(pipeR)
- library(xml2)
- library(rvest)
- library(stringr)
- testurl = "https://tcga-data.nci.nih.gov/tcga/findArchives.htm"
- x = POST(testurl, body = list(project = -1, center = -1, platform = -1, dataType = 29, archiveType = 2,
- fileName = "", dateStart="01/01/2016", dateEnd = "06/18/2016", ec_crd = 15, ec_p = 2), encode = "form") %>>%
- content %>>%
- xml_find_one("//table[@id='ec_table']") %>>% xml_find_all("//td[a='Download']/a") %>>%
- (.[xml_text(.) == "Download"]) %>>% lapply(xml_attr, attr = "href") %>>%
- str_extract("/tcgafiles/ftp_auth/distro_ftpusers/anonymous/[^']+") %>>%
- (str_c("https://tcga-data.nci.nih.gov", .))
- sapply(x, function(y){
- download.file(y, destfile = str_extract(y, "mdanderson.org_.*gz"))
- })
Add Comment
Please, Sign In to add comment