svysmooth2df | R Documentation |
Extracts the x and y values from one or more svysmooth objects, from the survey package, and returns them in a data frame.
svysmooth2df(...)
... |
One or more svysmooth objects with names. |
If multiple smooths are supplied, the x and y variables must be the same, but computed over different design objects (e.g., different subsets of a survey).
A data frame (tibble) with 3 columns: x, y, and a character vector indicating which values belong to which smooth
library(survey)
data(api)
dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)
dclus2<-subset(dclus1, sch.wide=="Yes" & comp.imp=="Yes")
m1 <- svysmooth(api00~ell,dclus1)
m2 <- svysmooth(api00~ell,dclus2)
df <- svysmooth2df(full = m1, subset = m2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.