Learn R Programming

eva3dm (version 0.99.1)

daily: Calculate daily mean, min or max

Description

function to calculate daily mean, min or max of a data.frame

Usage

daily(
  data,
  time = "date",
  var,
  stat = mean,
  min_offset = 0,
  hour_offset = 0,
  numerical = TRUE,
  verbose = TRUE
)

Value

data.frame with time and the daily mean, min or max

Arguments

data

data.frame with time column and variable columns to be processed

time

name of the time column (default is date) in POSIXct

var

name of the columns to be calculated

stat

function of the statistics to calculate (default is mean)

min_offset

minutes of observation from previous hour (default is 0)

hour_offset

hours of observation from previous day (default is 0)

numerical

TRUE (defoult) include only numerical columns

verbose

display additional information

Examples

Run this code
sites <- c("OAKB")
for(site in sites){
cat('downloading METAR from:',site,'...\n')
DATA <- riem::riem_measures(station    = sites,
                            date_start = "2012-01-01",
                            date_end   = "2012-02-01")
}
data_daily_mean <- daily(DATA,time = 'valid')
data_daily_min  <- daily(DATA[1:7],time = 'valid',stat = min)
data_daily_max  <- daily(DATA[1:7],time = 'valid',stat = max)

Run the code above in your browser using DataLab