| rmbl_core_stats | R Documentation |
Thin R wrappers over the rmoriebricklayer compiled core – the same
kernels that sibling packages reach through LinkingTo: rmoriebricklayer. NA/NaN values propagate (there is no na.rm); call
stats::na.omit() first if you need NA handling.
core_mean(x)
core_var(x)
core_cor(x, y)
x, y |
Numeric vectors (coerced with |
core_mean(), core_var() and core_cor() return a length-1
numeric. core_var() uses the n - 1 (sample) denominator, matching
stats::var().
## core_mean(): sample mean (NA/NaN propagate; no na.rm)
core_mean(1:10) # 5.5
core_mean(c(2.5, 3.5)) # 3
core_mean(c(1, 2, NA)) # NA -- call stats::na.omit() first if needed
core_mean(stats::na.omit(c(1, 2, NA)))
## core_var(): n-1 (sample) variance, matching stats::var()
core_var(c(2, 4, 4, 4, 5, 5, 7, 9))
all.equal(core_var(1:10), stats::var(1:10)) # agrees with base R
## core_cor(): Pearson correlation of two equal-length vectors
core_cor(1:10, (1:10)^2) # strong positive, near 0.97
core_cor(1:10, 10:1) # perfect negative: -1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.