[Rd] windrose (circular package) error in table (PR#8341)

Allyson.Williams@dpi.qld.gov.au Allyson.Williams at dpi.qld.gov.au
Tue Nov 22 02:50:46 CET 2005


Full_Name: Allyson Williams
Version: 2.1.1
OS: Windows XP
Submission from: (NULL) (203.25.1.208)


I'm using the 'Circular' package to plot windroses. I think the output table
(see out2$table below) is incorrect when using different rotations. More
precisely, when a rotation is used for the plot, the output table stuffs up.

This example is from the code in the help notes, although the input data (dir,
mag) are changed):

> dir <- c(1:50,1:50)
> mag <-  c(1:100)
> 
> sample <- data.frame(dir=circular(dir,units="degrees"), mag=mag)
> 
> par(mfrow=c(2,2))
> res <- windrose(sample)
> 
> ## we join two pedals and keep the same shrink (scale of the plot)
> breaks <- seq(0, 2 * pi, by = pi/6)
> breaks <- breaks[-2]
> out1<-windrose(sample, breaks=breaks, increment=50,main="The same but with two
pedals joined", shrink=res$shrink)
> #
> # change the rotation
> sample <- data.frame(dir=circular(dir, units="degrees", rotation="clock"),
mag=mag)
> out2<-windrose(sample, breaks=breaks,increment=50, main="Change the rotation",
shrink=res$shrink)
> 
> ## use geographics template
> sample <- data.frame(dir=circular(dir, units="degrees",
template="geographics"), mag=mag)
> out3<-windrose(sample, breaks=breaks, increment=50,main="Use the template
'geographics'", shrink=res$shrink)
> 

THESE are the output tables that seem to be incorrect (I'm sorry they're not
clearer):
> out1$table
               [0, 60) [60, 90) [90, 120) [120, 150) [150, 180) [180, 210) [210,
240) [240, 270) [270, 300) [300, 330) [330, 360)
>From 0 to 50       0.5        0         0          0          0          0      
   0          0          0          0          0
>From 50 to 100     0.5        0         0          0          0          0      
   0          0          0          0          0
> out2$table
               [0, 60) [60, 90) [90, 120) [120, 150) [150, 180) [180, 210) [210,
240) [240, 270) [270, 300) [300, 330) [330, 360)
>From 0 to 50         0        0         0          0          0          0      
   0          0          0          0        0.5
>From 50 to 100       0        0         0          0          0          0      
   0          0          0          0        0.5
> out3$table
               [0, 60) [60, 90) [90, 120) [120, 150) [150, 180) [180, 210) [210,
240) [240, 270) [270, 300) [300, 330) [330, 360)
>From 0 to 50         0      0.5         0          0          0          0      
   0          0          0          0          0
>From 50 to 100       0      0.5         0          0          0          0      
   0          0          0          0          0
> 


out1$table is correct. The data is all between 0-60degrees.
out2$table (changed rotation) is incorrect. The data are listed as being between
330-360degrees. 
Out3$table (geographic rotation) is incorrect. The data are listed as being
between 60-90degrees. 
Regardless of the rotation, the data should always be between 0-60degrees!

The problem only seems to occur when 'rotating' the plot.



More information about the R-devel mailing list