attach known populations to a dataframe
add.kp.Rdtake a known population vector (see df.to.kpvec) and
associate it with a survey dataframe. this makes it more convenient
to use some of the networksampling package's functions
Details
The total.popn.size parameter is interpreted as follows:
NA if total.popn.size is NA then work with proportions
NULL if total.popn.size is NULL (nothing passed in), then assume that there's a total.popn.size attribute associated with the dataset we're using
numerical value if an actual total.popn.size was passed in, use that value
Examples
if (FALSE) { # \dontrun{
# if kp.dat is a dataframe with columns 'kp' with known popn names
# and 'total.size' with the total size,
# and my.survey is the dataframe with survey responses
my.kp.vec <- df.to.kpvec(kp.data, kp.var='kp', kp.value='total.size')
my.survey <- add.kp(my.survey, my.kp.vec)
# now we can call estimator functions like
# kp.degree.estimator without having to specify known
# populations each time
} # }