Computes an approximate density useful for visualization. For proper
circular densities, use hdg_circular()
and circular::density.circular()
.
hdg_density( hdg, bw = 5, kernel = c("gaussian", "epanechnikov", "rectangular", "triangular", "biweight", "cosine", "optcosine"), weights = NULL, n = 512, na.rm = FALSE, ... ) # S3 method for hdg_density plot(x, main = NULL, xlab = NULL, ylab = NULL, axes = TRUE, ...) hdg_plot( hdg, density = hdg_density(hdg, na.rm = TRUE), main = NULL, xlab = NULL, ylab = NULL, axes = TRUE, ... )
hdg | A heading in degrees, where 0 is north,
90 is east, 180 is south, and 270 is west. Values
outside the range [0-360) are coerced to this range
using |
---|---|
bw | The bandwidth of the smoothing kernel. Automatic methods are not available, so you will have to set this value manually to obtain the smoothness you want. |
kernel | a character string giving the smoothing kernel
to be used. This must partially match one of
|
weights | numeric vector of non-negative observation weights,
hence of same length as |
n | the number of equally spaced points at which the density is
to be estimated. When |
na.rm | logical; if |
... | For |
x | the data from which the estimate is to be computed. For the default method a numeric vector: long vectors are not supported. |
main, xlab, ylab, axes | See |
density | A |
An object identical to stats::density()
but with class
"hdg_density".
#> #> Call: #> hdg_density(hdg = x, na.rm = TRUE) #> #> Data: x (512 obs.); Bandwidth 'bw' = 5 #> #> x y #> Min. : 0 Min. :0.000000 #> 1st Qu.: 90 1st Qu.:0.000000 #> Median :180 Median :0.000000 #> Mean :180 Mean :0.002797 #> 3rd Qu.:270 3rd Qu.:0.000000 #> Max. :360 Max. :0.046648hdg_plot(x)