if (FALSE) {
## load and prepare data
data("winddata", package="bReeze")
set40 <- set(height=40, v.avg=winddata[,2], dir.avg=winddata[,14])
set30 <- set(height=30, v.avg=winddata[,6], dir.avg=winddata[,16])
set20 <- set(height=20, v.avg=winddata[,10])
ts <- timestamp(timestamp=winddata[,1])
neubuerg <- mast(timestamp=ts, set40, set30, set20)
neubuerg <- clean(mast=neubuerg)
## calculate frequency
frequency(mast=neubuerg, v.set=1)
# if only one of v.set and dir.set is given,
# the dataset is assigned to both
frequency(mast=neubuerg, v.set=1)
frequency(mast=neubuerg, dir.set=1)
# use different datasets for wind speed and direction
frequency(mast=neubuerg, v.set=3) # no direction in dataset
frequency(mast=neubuerg, v.set=3, dir.set=2)
frequency(mast=neubuerg, v.set="set3", dir.set="set2") # same as above
# change number of direction sectors
frequency(mast=neubuerg, v.set=1, num.sectors=4)
frequency(mast=neubuerg, v.set=1, num.sectors=16)
# calculate frequency for 1 m/s speed bins and without binning
frequency(mast=neubuerg, v.set=1, bins=1:25)
frequency(mast=neubuerg, v.set=1, bins=0:25) # same as above
frequency(mast=neubuerg, v.set=1, bins=NULL)
# data subsets
frequency(mast=neubuerg, v.set=1,
subset=c("2009-12-01 00:00:00", "2009-12-31 23:50:00"))
frequency(mast=neubuerg, v.set=1,
subset=c("2010-01-01 00:00:00", NA)) # just 'start' time stamp
frequency(mast=neubuerg, v.set=1,
subset=c(NA, "2009-12-31 23:50:00")) # just 'end' time stamp
# change number of digits and hide results
frequency(mast=neubuerg, v.set=1, digits=2)
neubuerg.freq <- frequency(mast=neubuerg, v.set=1, print=FALSE)
neubuerg.freq
## plot frequency objects
plot(neubuerg.freq) # default
plot(neubuerg.freq, col=gray(5:0 / 5.5), cex=0.8) # change colours/text sizes
plot(neubuerg.freq, circles=c(10, 30, 10)) # manual definition of circles
plot(neubuerg.freq, fg=TRUE) # plot sectors in foreground
plot(neubuerg.freq, pos.axis=135) # change axis label position
plot(neubuerg.freq, width.leg=0) # no legend
# freaky
plot(neubuerg.freq, border.leg=heat.colors(5), bty.leg="o",
cex.axis=0.5, cex.lab=2, cex.leg=0.5, circles=c(5, 30, 5),
col=rainbow(5), col.axis="green", col.border="orange",
col.circle="purple", col.cross="yellow", col.lab="pink",
col.leg="lightblue", fg=TRUE, lwd.border=2, lwd.circle=3, lwd.cross=3,
lty.circle="12345678", lty.cross="87654321", sec.space=0.6,
title.leg="* WiNd SpEeD *", x.intersp=2, y.intersp=5)
}
Run the code above in your browser using DataLab