read_cr2 {hydrotoolbox} | R Documentation |
Reads data from Explorador Climático (CR2 - Chile)
Description
Reads csv files downloaded from the CR2 web page as a data frame.
Usage
read_cr2(path, by = "day", out_name = NULL)
Arguments
path |
path to the csv file. |
by |
string with the time step of the series (e.g.: |
out_name |
optional. String vector with user defined variable(s) column(s) name(s). |
Value
A data frame with the data inside the csv file. Gaps between dates are
filled with NA_real_
and duplicated rows are eliminated automatically.
Examples
# list cr2 files
list.files( system.file('extdata', package = 'hydrotoolbox'), pattern = 'cr2' )
# set path to file
path_tmax <- system.file('extdata', 'cr2_tmax_yeso_embalse.csv',
package = 'hydrotoolbox')
# read file with default colname
head( read_cr2(path = path_tmax) )
# assign a column name
head( read_cr2(path = path_tmax, out_name = 'tmax(°C)') )
[Package hydrotoolbox version 1.1.2 Index]