I am working with data from the USGS with data every 30 minutes from
4/27/2011 to 8/25/2011.

I am having trouble with setting the frequency.

 

My R script is below:

 

> shavers=read.csv("shavers.csv")

> names(shavers)

 [1] "agency_cd"    "site_no"      "datetime"     "tz_cd"        "Temp"


 [6] "X04_00010_cd" "EC25"         "X05_00095_cd" "DO"
"X06_00300_cd"

[11] "pH"           "X07_00400_cd"

> as.POSIXct(shavers[1,3])

[1] "2011-04-27 EDT"

> as.POSIXct(shavers[nrow(shavers),3])

[1] "2011-08-25 23:00:00 EDT"

> temp=ts(shavers[,5],as.POSIXct(shavers[1,3]),frequency=48)

Error in attr(data, "tsp") <- c(start, end, frequency) : 

  invalid time series parameters specified

 

I have also used xts:

 

> plot(temp)

> library(xts)

> temp=xts(shavers[,5],order.by=as.POSIXct(shavers[,3]),frequency=48)

> stl(temp,s.window='periodic')

Error in stl(temp, s.window = "periodic") : 

  series is not periodic or has less than two periods

 

The data has very clear daily periods. How can I configure my time
series to analyze this?

 

Thank you very much.


	[[alternative HTML version deleted]]

