Skip to contents

Find approx percentiles in lookup table that is in memory

Usage

lookup_pctile(
  myvector,
  varname.in.lookup.table,
  lookup = usastats,
  zone = "USA"
)

Arguments

myvector

Numeric vector, required. Values to look for in the lookup table.

varname.in.lookup.table

Character element, required. Name of column in lookup table to look in to find interval where a given element of myvector values is.

*** If vector is provided, then must be same length as myvector,

but only 1 value for zone can be provided.

lookup

Either lookup must be provided, not quoted, or a lookup table called usastats must already be in memory. This is the lookup table data.frame with a PCTILE column, REGION column, and column whose name is the value of varname.in.lookup.table To use state lookups set lookup=statestats

zone

Character element (or vector as long as myvector), optional. If specified, must appear in a column called REGION within the lookup table, or NA returned for each item looked up and warning given. For example, it could be "NY" for New York State, "USA" for national percentiles.