read_cr2: Reads data from Explorador Climático (CR2 - Chile)

Description Usage Arguments Value Examples

View source: R/ff_read_cr2.R

Description

Reads csv files downloaded from the CR2 web page as a data frame.

Usage

1
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.: 'month', 'day', '6 hour', '3 hour', '1 hour', '15 min' ). The default and unique possible value is 'day'.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# 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)') )

hydrotoolbox documentation built on July 9, 2021, 1:06 a.m.