createInputForDescriptives | R Documentation |
Create a variable information data.frame from the GADSdat object. This input can be used
to calculate the descriptives of the data via the calculateDescriptives
function.
See the details section for further information.
createInputForDescriptives(
GADSdat,
idExpr = "^ID",
impExpr = c("IMPUTATION\\s+{0,1}[[:digit:]]{1,2}", "PV\\s+{0,1}[[:digit:]]{1,2}"),
scaleExpr = "^Skala",
itemExpr = "plausible|indikator",
fakeItemExpr = "fake",
nwExpr = "IDinClass",
varNameSeparatorImp = "_",
ncharSeparatorImp = 2,
lastOccurrence = TRUE,
groupSuffixImp = "imp",
nCatsForOrdinal = c(2:5),
nwVarNameSeparatorImp = "_",
nwNcharSeparatorImp = 6,
nwLastOccurrence = TRUE,
verbose = FALSE
)
GADSdat |
Object of class |
idExpr |
Regular expression to identify ID variables from variable names (Note: for multiple
expressions, i.e. if |
impExpr |
Regular expression to identify imputed variables from variable labels in GADSdat
object (Note: for multiple expressions, i.e. if |
scaleExpr |
Regular expression to identify scale or fake scale variables from variable labels in GADSdat
object (Note: for multiple expressions, i.e. if |
itemExpr |
Regular expression to identify items which constitute a true scale from the variable
labels in GADSdat object. Note: Only the regular expressions that identify the items must be entered here.
The additional scale variables do not have to be specified. If several scales are defined in the data set
(e.g. "self concept" and interest), no distinction needs to be made here as to which items belong to which
scale. (This is done elsewhere.) Assume that the "self concept" is measured with the items |
fakeItemExpr |
Regular expression to identify fake items which constitute a fake scale from the variable
labels in GADSdat object. This works in the same way as with |
nwExpr |
Regular expression to identify network variables from variable labels in GADSdat object
(Note: for multiple expressions, i.e. if |
varNameSeparatorImp |
character sign to separate the "pooled" suffix from group name in group
column. For example, if multiple imputed variables occur in the wide-format data.frame as |
ncharSeparatorImp |
Integer: only relevant if no |
lastOccurrence |
Logical: If |
groupSuffixImp |
tbd |
nCatsForOrdinal |
Numeric vector with number of categories considered for ordinal variables. Variables with number of categories as defined here are considered to be ordinal instead of nominal. If NULL, this rule will be ignored, and nominal/ordinal assignment is done in other ways |
nwVarNameSeparatorImp |
character sign to separate network variable names from network variable groups.
For example, if network variables occur as |
nwNcharSeparatorImp |
Integer: only relevant if no |
nwLastOccurrence |
Logical: If |
verbose |
Should scale identification be reported? |
The eatCodebook
package aims to create a human-readable pdf codebook from a GADSdat
data base object. The codebook
contains information about the variables used in the study, including their descriptive properties. Which descriptive properties are reported
in the codebook depends, among other things, on the scale level of the variables. For example, the mean and standard deviation are reported
for metric variables and frequency distributions for categorical variables. For non-imputed variables, the proportion of missing values is
also given, and for scale variables, the number of items that make up the scale and the internal consistency of the scale are given. The
codebook is created in several steps. In the first step, the createInputForDescriptives
function is used to generate an auxiliary
object from the database that contains information on what type of descriptive information is to be reported for which variable. The object
created in this function is the basis for the calculateDescriptives
function.
Returns a data.frame
with variable information with following columns
varName
The name of the variable as it occurs in the data
varLabel
The label of the variable as it occurs in the GADSdat
label sheet
format
The variable format as displayed in the labels sheet of the GADSdat
object
imp
Logical: Whether or not the variable is imputed
type
The type of the variable. Two possible entries, variable
or scale
scale
The scale level of the variable. Possible entries: nominal
, ordinal
, numeric
. ID variables and character variables have missing entries in this column. Be cautious that 'ordinal' sometimes may be allocated erroneously. The resulting table should be exported to Excel for further checks.
group
If the variable is part of a scale with several items, a common entry in the group column indicates that these variables belong together
varInfo <- createInputForDescriptives(eatGADS::pisa, impExpr = "Plausible Value")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.