[R] Formatting time stamps for weibull distribution

David Winsemius dwinsemius at comcast.net
Mon Nov 4 09:16:44 CET 2013


On Nov 3, 2013, at 11:50 PM, kmmoon100 wrote:

> Hello everyone,
> 
> I have been using bReeze package for weibull distribution analysis.
> In this package, there is a function called 'formatTS' for converting time
> stamps from string to POSIXlt.
> (http://rgm3.lab.nig.ac.jp/RGM/R_rdfile?f=bReeze/man/formatTS.Rd&d=R_CC)
> This is a part of process to plot and calculate shape and scale of the
> distribution. 
> However, this function keeps showing an error message.
> 
> ts1 <- formatTS(time.stamp = winddata_ballarat[,1])
> 1  1383549939 
> 2  1383549939 
> 3  1383549939 
> 4  1383549953 
> Error in formatTS(time.stamp = winddata_ballarat[, 1]) : No pattern found

Shouldn't you after reading that manual page be adding format="%d.%m.%Y %H:%M:%S" ?

.
> 
> The format of the time series (200000 rows) I have is dd.mm.yyyy hh:mm for
> 12 years.. such as..
> 
> Time	                   Wind speed    Wind direction
> 25.07.2000 0:00:00	15	20
> 25.07.2000 0:30:00	11	20
> 25.07.2000 1:00:00	18	10
> 25.07.2000 1:30:00	17	10
> 25.07.2000 2:00:00	22	360
> 25.07.2000 2:30:00	22	360
> 25.07.2000 3:00:00	26	360
> 25.07.2000 3:30:00	28	360
> .                                         .             .
> . 
> 
> 
> I have no idea why the function cannot find a pattern..

Because you didn't offer one?

> 
> Surprisingly, when the same data and the same function was used in my
> colleague's computer, it worked. So I tried processing in other computers
> but failed. 
> 
> I tried using strftime

`strftime` is for output. `strptime` is for input.

> function too but result is not reliable, which
> indicates there is a mismatch between the time stamp I created and wind
> speed.

It only indicates you didn't read the section on the pattern/format arguments.

-- 
David
> 
> Could anyone know why it keeps happening and how to solve this problem?
> All R codes are described below:
> 
> winddata_ballarat <- read.csv("ballarat1.csv",header=TRUE,sep=",")
> set2 <- createSet(height=10, v.avg=winddata_ballarat$Wind.speed,
> dir.avg=winddata_ballarat$Wind.direction)

> ts1 <- formatTS(time.stamp = winddata_ballarat[,1])
> kangmin.ballarat <- createMast(time.stamp=ts, set2)

ts != ts1

> kangmin.ballarat.wb <- weibull(mast=kangmin.ballarat, v.set=1, print=FALSE)
> plotWeibull(wb=kangmin.ballarat.wb, show.ak =TRUE)
> weibull(mast=kangmin.ballarat, v.set=1)
> 
> Thank you.
> 
> 
> 
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Formatting-time-stamps-for-weibull-distribution-tp4679666.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list