View source: R/subhourly2hourly.R

subhourly2hourly | R Documentation |

Generic function for transforming a sub-HOURLY time series into an HOURLY one

```
subhourly2hourly(x, ...)
## Default S3 method:
subhourly2hourly(x, FUN, na.rm=TRUE, na.rm.max=0, ...)
## S3 method for class 'zoo'
subhourly2hourly(x, FUN, na.rm=TRUE, na.rm.max=0, ...)
## S3 method for class 'data.frame'
subhourly2hourly(x, FUN, na.rm=TRUE, na.rm.max=0,
dates=1, date.fmt="%Y-%m-%d %H:%M:%S", out.fmt="zoo",
verbose= TRUE, ...)
## S3 method for class 'matrix'
subhourly2hourly(x, FUN, na.rm=TRUE, na.rm.max=0,
dates=1, date.fmt="%Y-%m-%d %H:%M:%S", out.fmt="zoo",
verbose= TRUE, ...)
```

`x` |
zoo, data.frame or matrix object, with sub-hourly time series. |

`FUN` |
Function that have to be applied for transforming from sub-hourly to hourly time step. (e.g., for precipitation |

`na.rm` |
Logical. Should missing values be removed? |

`na.rm.max` |
Numeric in [0, 1]. It is used to define the maximum percentage of missing values allowed in each hour to keep the hourly aggregated value in the output object of this function. In other words, if the percentage of missing values in a given hour is larger or equal than |

`dates` |
numeric, factor, POSIXct or POSIXt object indicating how to obtain the dates and times for each column of |

`date.fmt` |
character indicating the format in which the dates are stored in |

`out.fmt` |
OPTIONAL. Only used when |

`verbose` |
logical; if TRUE, progress messages are printed |

`...` |
further arguments passed to or from other methods. |

a zoo object with hourly time series

Mauricio Zambrano-Bigiarini, mzb.devel@gmail

`subhourly2nminutes`

,, `subdaily2daily`

, `subdaily2monthly`

, `subdaily2annual`

, `subdaily2seasonal`

, `as.POSIXct`

, `dm2seasonal`

, `monthlyfunction`

, `seasonalfunction`

, `hydroplot`

, `vector2zoo`

, `izoo2rzoo`

```
## Creating a 15-min time sequence and counting its length
dt <- seq( from=as.POSIXct("2021-06-30 00:15"), to=as.POSIXct("2021-06-30 23:45"), by="15 min" )
ndt <- length(dt)
## Creating a dummy 15-min zoo object, with 1 as the only value in each time period
x <- zoo( rep(1, ndt), dt)
## sub-hourly to hourly
h1 <- subhourly2hourly(x, FUN=sum, na.rm=TRUE)
## Aggregation of 3 sub-hourly ts (i.e., a zoo matrix) into an hourly one
X <- cbind(x, x, x)
h2 <- subhourly2hourly(X, FUN=sum, na.rm=TRUE)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.