ecdfSteps {Hmisc} | R Documentation |
ecdfSteps
Description
Compute Coordinates of an Empirical Distribution Function
Usage
ecdfSteps(x, extend)
Arguments
x |
numeric vector, possibly with |
extend |
a 2-vector do extend the range of x (low, high). Set |
Details
For a numeric vector uses the R built-in ecdf
function to compute
coordinates of the ECDF, with extension slightly below and above the
range of x
by default. This is useful for ggplot2
where the ECDF may need to be transformed. The returned object is suitable for creating stratified statistics using data.table
and other methods.
Value
a list with components x
and y
Author(s)
Frank Harrell
See Also
Examples
ecdfSteps(0:10)
## Not run:
# Use data.table for obtaining ECDFs by country and region
w <- d[, ecdfSteps(z, extend=c(1,11)), by=.(country, region)] # d is a DT
# Use ggplot2 to make one graph with multiple regions' ECDFs
# and use faceting for countries
ggplot(w, aes(x, y, color=region)) + geom_step() +
facet_wrap(~ country)
## End(Not run)
[Package Hmisc version 5.1-3 Index]