Description Usage Arguments Details Value Examples
View source: R/cc_data_fetch.R
Download CCAFS data
1 | cc_data_fetch(key, overwrite = FALSE, ...)
|
key |
(character) a character string specifying a S3 key
or a URL (the output from a call to |
overwrite |
(logical) Whether to overwrite files if they already
exist on your machine. Default: |
... |
Curl options passed on to crul::verb-GET |
Note that data is not read into R as data can be very large.
See cc_data_read()
Look in rappdirs::user_cache_dir("ccafs")
for what files are
cached and to delete any.
Note that we've made it so that you can index into the return object,
getting either one or many results and the S3 class will be retained,
so that you can pass the result down to cc_data_read()
A character vector of full file paths. A print method makes a tidy return object in an S3 class.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## Not run:
key <- "ccafs/ccafs-climate/data/ipcc_5ar_ciat_downscaled/rcp2_6/
2030s/bcc_csm1_1_m/10min/
bcc_csm1_1_m_rcp2_6_2030s_prec_10min_r1i1p1_no_tile_asc.zip"
(res <- cc_data_fetch(key = key))
# indexing maintains class for easier subsetting
res[1]
res[[1]]
res[1:2]
res <- cc_list_keys()
zips <- grep("\\.zip", res$Key, value = TRUE)
x <- cc_data_fetch(zips[1])
unclass(x)
cc_data_read(x[1])
cc_data_read(x[1:3])
cc_data_read(x)
library(raster)
plot(cc_data_read(x[1]))
plot(cc_data_read(x[1:3]))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.