Calculate descriptive statistics which should be included in the codebook.
Arguments
- GADSdat
Object of class
GADSdat, created for example byimport_spssfrom theeatGADSpackage.- inputForDescriptives
data.framewith variable information. This table can either be created manually in Excel or generated from GADSdat object, using the functioncreateInputForDescriptives. If you need a template of what this table should look like for different variables, you can use thevarInfoobject created in the examples below. Specifically, thedata.framemust contain the following columns.varName: This character column should contain all variable names that are part of the GADS database.varLabel: The variable label of the corresponding variable in thevarNamecolumnformat: This character columns yields the format of the corresponding variable in thevarNamecolumn, for exampleF8.0imp: Logical column (i.e.,TRUE/FALSE) which indicates whether the variable is imputedtype: Character column with possible entriesvariable,item,fake_itemorscale. The entryvariableshould be used for individual variables in theGADSdatdatabase that belong neither to a scale nor to a fake scale. The entryitemshould be used for items which belong to a scale. No distinction needs to be made as to which scale these items belong to. It is only important that the database contains one or more scales for each of these items. Assume that the database contains the scales "self concept" and "interest", where "self concept" is measured with the itemsSK_I1,SK_I2,SK_I3, and "interest" is measured with the itemsInt_I1,Int_I2,Int_I3,Int_I4. ThenSK_I1,SK_I2,SK_I3,Int_I1,Int_I2,Int_I3, andInt_I4should occur in thevarNamecolumn, and the corresponding entry intypeshould beitem. Note that the database also contains the scale variables of "self concept" and "interest". The entryfake_itemshould be used for items that theoretically constitute one or more latent scales, but for which no scale variable is contained in the database.scale: Character column with the scale level of the corresponding variable. Possible entries arenumericfor metric variables,ordinalfor categorical (factor) variables, ornominal.group: Character column which is only relevant for items, scales or fake scale variables. For all others, only the variable name is transferred here. For the other variables, an indicator is defined here that contains the assignment of items to their scales. Assume that the database contains the scale "self concept" which is measured with the itemsSK_I1,SK_I2,SK_I3. Let the scale variable of "self concept" be calledSC. A common entry forSK_I1,SK_I2,SK_I3, andscaleSelfConceptshould be entered in thegroupcolumn, for example"scaleSelfConcept"
- verbose
Print variable and function information to console?
- showCallOnly
Logical: only for diagnostics. If TRUE, no calculation is proceed, and only the function which is called for calculation is returned.
Value
Returns a list of descriptive statistics. This format may seem unsuitable for direct further processing in R, but is primarily used for the automatic creation of codebooks using Latex.
Examples
# import spss exemplary data
file <- system.file("extdata", "example1_clean.sav", package = "eatCodebook")
dat <- eatGADS::import_spss(file)
# create variable information by the eatCodebbok function createInputForDescriptives
# This table 'varInfo' can be exported to Excel for further inspection and used as a
# blueprint of what the necessary 'inputForDescriptives' argument for the
# calculateDescriptives() function should look like
varInfo <- createInputForDescriptives(dat, impExpr = "plausible value")
# calculate descriptives
descr <- calculateDescriptives(dat, varInfo)
#> Warning: `report()` was deprecated in eatRep 0.15.0.
#> ℹ For the original behavior of report() please use eatRep version 0.14.7:
#> 'https://cran.r-project.org/src/contrib/Archive/eatRep/'
#> ℹ The deprecated feature was likely used in the eatCodebook package.
#> Please report the issue to the authors.
