smean | R Documentation |
Calculate the survey mean
smean(x, ...)
## Default S3 method:
smean(
x,
na.rm = T,
var_type = "none",
ci_method = "mean",
level = 0.95,
use_df = T,
ids,
sv,
st,
...
)
## S3 method for class 'character'
smean(x, ...)
## S3 method for class 'character'
stotal(x, ...)
x |
vector. Vector of values to compute a weighted mean over |
... |
other arguments. Currently unused. |
na.rm |
logical. Determines whether NAs are excluded from the analysis |
var_type |
character. Report variability as one or more of: standard error ("se", default) and confidence interval ("ci") |
ci_method |
character. Determines how the ci (if requested via |
level |
numeric. A value in the range of (0, 1) denoting what level of confidence the CI should be |
use_df |
logical. Should the estimated degrees of freedom by used to calculate CIs? Default is TRUE. FALSE implies df = Inf.
|
ids |
numeric. indices which are being computed. Can be generally omitted and will be added to the call via '[.dtsurvey' |
sv |
data.table. Data.table of psu, strata, weight and the like to properly do survey statistics. |
st |
character. type of survey dataset being analyzed. Can be generally omitted and will be added to the call via '[.dtsurvey' |
If var_type is "none", a vector is returned. For factors, the names of the vector correspond to the levels. When var_type is not "none" a named list is returned (and then likely converted into a data.table). The list (which should be named) is ordered in the following manner (by slot): result, se, lower, upper, levels.
a vector or a list (the latter likely converted into a data.table) containing the results
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.