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

View source: R/ff_read_cr2.R

read_cr2R 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.: '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


# 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 April 14, 2023, 12:34 a.m.