View source: R/helper.functions.r
| wtd.quantile | R Documentation | 
Takes in variable and calculates desired quantile values, works with sampling weights. Makes use of the wtd.quantile function from the Hmisc package. See wtd.stats documentation for details.
wtd.quantile(x, w = NULL, data, q = c(5, 10, 25, 50, 75, 90, 95),
  digits = 3, ...)
| x | A variable (must be numeric), should be in dataset$var form unless dataset specified in optional data argument. | 
| w | (Optional) Sampling weights of variable, must be numeric; should be in dataset$weightvar form unless dataset specified in optional data argument. | 
| data | (Optional) Name of dataset that contains x (and w) variable. | 
| q | (Optional) The quantiles you want calculated as a number or vector of numbers. Input as percentages. For median only, q=50. For quartiles, q=c(25, 50, 75). | 
| digits | (Optional) Number of decimal places reported in result (defaults to 3). | 
| ... | (Optional) Additional arguments passed to Hmisc::wtd.quantile function. | 
Returns quantile values of a variable, a vector of numeric values.
   library(RCPA3)
   
   wtd.quantile(x=nes$ft.police, q=c(25, 50, 75), w=nes$wt)
   wtd.quantile(x=nes$ft.police, q=c(25, 50, 75))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.