rolldfapply: Wrapper for 'rollapply'

Description Usage Arguments Value See Also Examples

Description

Function rollapply applied to a Data Frame structured as follows: Time,Station,Variable,Value

Usage

1
2
rolldfapply(data, TimeField = "Time", ValueField = "value",
  align = "right", ...)

Arguments

data

data frame

TimeField

character string containg time field of data

ValueField

character string containg time field of data

align

argument of rollapply. Default value is here set to right.

...

arguments for rollapply

Value

A data frame with the same format of data with "rolled" calculated values.

See Also

rollapply

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(ncdf4df)
## ncname <- "/Users/ecor/Dropbox/iasma/RMAWGENdev/ncdf4df/inst/trentino/data/trentino_hourlyweatherdata.nc"
ncname <- system.file("trentino/data/trentino_hourlyweatherdata.nc",package="ncdf4df")
nc <- nc_open(ncname)
meteoPrec <- ncvar_get_df_values(nc=nc,x="Prec",verbose=TRUE)

nc_close(nc)

width <- 3 ## rolling windows of 3 time inidices, e.g. hour
meteoPrec3h <-  rolldfapply(data=meteoPrec,width=width,FUN=sum,align="right") ## l

ecor/ncdf4df documentation built on May 15, 2019, 10:06 p.m.