svysmooth2df: svysmooth2df

svysmooth2dfR Documentation

svysmooth2df

Description

Extracts the x and y values from one or more svysmooth objects, from the survey package, and returns them in a data frame.

Usage

svysmooth2df(...)

Arguments

...

One or more svysmooth objects with names.

Details

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).

Value

A data frame (tibble) with 3 columns: x, y, and a character vector indicating which values belong to which smooth

Examples

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)

grasshoppermouse/hagenutils documentation built on Dec. 6, 2024, 8:31 p.m.