cc_data_read: Read CCAFS data

Description Usage Arguments Details Value Examples

View source: R/cc_data_read.R

Description

Read CCAFS data

Usage

1
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

 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)

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

ropenscilabs/ccafs documentation built on Jan. 6, 2018, 8:32 p.m.