简体   繁体   中英

Hourly Time Series Analysis on r in Hydrology

I am trying to separate the events from streamflow data. I have hourly data. I have run the code

dailyMQ <- data.frame(Date=seq(from=as.Date("01.01.2000", format="%d.%m.%Y"), 
to=as.Date("01.01.2004", format="%d.%m.%Y"), by="days"), 
discharge=rbeta(1462,2,20)*100)

for daily data. But I am trying for hourly data but getting errors. Could anyone suggest me how to write a code for hourly data?

Thanks

Date format can't directly be split into hours.

You could use POSIXct datetime format:

HourlyMQ <- data.frame(Date=seq(from=as.POSIXct("01.01.2019", format="%d.%m.%Y"), to=as.POSIXct("11.12.2019", format="%d.%m.%Y"),by="hours"),discharge=rbeta(8257,2,20)) 
HourlyMQ
#>                     Date    discharge
#> 1    2019-01-01 00:00:00 0.2452214482
#> 2    2019-01-01 01:00:00 0.0620291334
#> 3    2019-01-01 02:00:00 0.0608788870
#> 4    2019-01-01 03:00:00 0.0697449808
#> 5    2019-01-01 04:00:00 0.0302780135



The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM