cc_data_read: Read CCAFS data

View source: R/cc_data_read.R

cc_data_readR Documentation

Read CCAFS data

Description

Read CCAFS data

Usage

cc_data_read(x, unreadable = "filter")

Arguments

x

A ccafs_files object, the output from a call to cc_data_fetch()

unreadable

(character) what to do when unreadable files are passed in. default is to filter them out and proceed ("filter") - alternatively, you can choose "stop", in which case we'll stop with a message.

Details

Look in rappdirs::user_cache_dir("ccafs") for what files are cached and to delete any.

cc_data_fetch() downloads data to your machine, and this function reads the data into your R session.

For more control over vizualizations of raster data, check out the rasterVis package (https://CRAN.R-project.org/package=rasterVis)

Value

RasterLayer or RasterStack class object. See their help files in raster package documentation.

Examples

## 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)

# a single file
cc_data_read(res[1])

# select individual files
cc_data_read(res[1:2])

# all files
cc_data_read(res)

# character path input
## you can also pass in a path to a file(s)
cc_data_read(unclass(res[1]))

# plot data
library(raster)
plot(cc_data_read(res[1:3]))

## End(Not run)

ropensci/ccafs documentation built on May 18, 2022, 9:49 a.m.