Description Usage Arguments Privat fields (R6) Public methods (R6) Note Author(s) Examples
Create a new Survey from a data.frame, data.table or tbl.
The class Survey provides additional private (hidden) fields pertaining
to the Survey/data, but should otherwise behave like a regular data.frame.
1 2 3 4 5 6 7 8 9 10 11 |
x |
A |
labelsA label (question text) associated with a given variable in the data.
associationSpecification of what the variable is associated
with. This field is used to specify the structural model for the PLS-PM
modelling, in addition to other variables of interest for an analysis.
configThis field keeps track of configurations made by
the user when working on the Survey.
translationsA dictionary containing translations to be used when generating output based on Survey.
marketsharesThe marketshares used for individual entities when producing weighted averages/counts from the Survey.
newInitialize a new Survey. Expects a data.frame,
data.table or tbl as input.
doDo arbitrary operations on the Survey. First argument
should be the function, second a list of arguments for do.call.
get_dataReturn a copy of the data.
modelReturn a summary of the data for the Survey.
This includes labels and associations, and the object (survey_model)
prints nicely.
entitiesThis method produces a summary of the entities (total/valid observations and marketshare) if they have been specified.
Under the hood, the Survey is a R6 class - this means that $ is
reserved for accessing the public methods of the class, and not columns in the
data directly. S3 methods are provided (and prefered) to make the Survey
behave more like regular R objects.
Kristian D. Olsen
1 2 3 4 5 6 7 | # Create a new survey (regular)
df <- survey_df(data.frame("A" = 1, "B" = 2))
dt <- survey_dt(data.frame("A" = 1, "B" = 2))
if (require(dplyr)) {
tbl <- survey_tbl(data.frame("A" = 1, "B" = 2))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.