pborepo_gitdata: Retrieve data from the 'pborepo' online repository (github)

View source: R/https.R

pborepo_gitdataR Documentation

Retrieve data from the pborepo online repository (github)

Description

Retrieve data from the pborepo online repository (github)

Usage

pborepo_gitdata(
  file = NULL,
  save.local = FALSE,
  saf = FALSE,
  verbose = TRUE,
  ...
)

list_github_files()

Arguments

file

character; the name of the file to retrieve; if this is NULL only the results of list_github_files are returned

save.local

logical; should the file be saved locally

saf

logical; the value of stringsAsFactors

verbose

logical;

...

additional parameters to read.https

See Also

read.https, which is used to retrieve the data

Examples

## Not run: 
#
list_github_files() # returns the filenames, with other info
#
print(gitfiles <- pborepo_gitdata()) # returns only the filenames
print(lsm <- pborepo_gitdata("lsm_coords")) # returns a data.frame
pborepo_gitdata("bogus_filename") # an error, as expected
#
# Get them all with plyr/dplyr
library(plyr)
library(dplyr, warn.conflicts=FALSE)
FUNC <- function(fi){tbl_df(pborepo_gitdata(fi, verbose=FALSE))}
alldata <- llply(gitfiles, FUNC, .progress = 'text')
names(alldata) <- gitfiles
summary(alldata)
print(str(alldata, vec.len=2, nchar.max=10))
lsm2 <- alldata[['lsm_coords']]
all.equal(tbl_df(lsm),lsm2)

## End(Not run)

abarbour/pborepo documentation built on April 27, 2022, 8:47 a.m.