I am wondering if there exists a function or a link or any method that would work like list.files()
function in R but on a folder stored on a github repostiory.
example github repository folder: https://github.com/KZPS/Spotkania/tree/master/Matteo/literature
Thanks for any advice !
Here's one way:
library(httr)
req <- GET("https://api.github.com/repos/KZPS/Spotkania/git/trees/master?recursive=1")
stop_for_status(req)
filelist <- unlist(lapply(content(req)$tree, "[", "path"), use.names = F)
grep("Matteo/literature/", filelist, value = TRUE, fixed = TRUE)
# [1] "Matteo/literature/Subsetting.pdf"
# [2] "Matteo/literature/datatable-intro.pdf"
You could easily build a function list.files.github
from that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With