View source: R/adcp_count_obs.R
adcp_count_obs | R Documentation |
Count number and proportion of observations in equal intervals
adcp_count_obs(
dat,
column = sea_water_speed_cm_s,
n_ints = 12,
n_digits = 4,
label_sep = "\n",
lowest = FALSE
)
dat |
Data frame including the column with observations that will be
assigned to intervals. The interval size is determined by the range of
these observations and |
column |
Column in |
n_ints |
Number of intervals to divide observations into. The interval
size is determined by the range of these observations and |
n_digits |
Number of digits to show in interval labels. Note that
additional digits may be used in the actual break values. See vignettes for
more detail. Passed to the |
label_sep |
Separator for the interval labels ("lower to upper"). Default is a new line to save room on plot axis. |
lowest |
Logical. If |
Assigns intervals to column
using the cut()
function.
Argument right = TRUE
to match the intervals assigned in the
openair::windRose()
function (which is called in
adcp_plot_current_rose()
). This means intervals are right-inclusive,
i.e., a value of 4 is assigned to the interval (1,4].
NOTE: The openair::windRose()
function has the cut()
argument include.lower
hard-coded to FALSE
. This causes an
issue with the intervals extracted from adcp_count_obs()
being
passed to adcp_plot_current_rose()
(which passes all arguments to
openair::windRose()
).
Assume the first interval is in the form (x1, x2], and the minimum value of the observations is xmin.
This means that if the round(x1, digits = n_digits) equals xmin, values of
xmin will NOT be assigned to an interval. In this case, xmin falls outside
of the first interval (because it is left exclusive). To avoid this,
n_digits should be large enough to ensure round(x1, digits = n_digits) <
xmin. This could also be solved if include.lower
could be set to
TRUE
in openair::windRose()
.
NOTE: I submitted a Pull Request to Open Air. I think it was merged. So could update the include.lower call here, but will need to think about this.
Returns a data frame of lower and upper interval limits (right inclusive), and frequency and proportion of observations in each interval.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.