lsa.vars.dict {RALSA} | R Documentation |
Produce dictionary for large-scale assessments data variables
Description
Utility function to display dictionaries of variables from data sets containing objects of class lsa.data
.
Usage
lsa.vars.dict(
data.file,
data.object,
var.names,
out.file,
open.out.file = FALSE
)
Arguments
data.file |
Full path to the |
data.object |
The object in the memory containing |
var.names |
Vector of variable names whose dictionaries shall be produced. See details. |
out.file |
Optional, full path to a |
open.out.file |
Optional, if file path is provided to |
Details
Either data.file
or data.object
shall be provided as source of data. If both of them are provided, the function will stop with an error message.
If var.names
are not provided, then the function will produce dictionaries for all variables in the file/object.
The function will print the dictionaries on the screen. If these need to be saved to a file for further reference as well, a full path to the .txt
file shall be provided. If the file exists, it will be overwritten. If the file name is provided to out.file
and open.out.file = TRUE
, it will be automatically open in the default text editor after being written.
Value
The dictionaries for the variables in var.names
will be printed as tables on the screen. For each variable the dictionaries contain the variable name, the variable class, the variable label, unique variable values (see below) and the user-defined missing values (if any).
The unique values' representation will depend on the variable class. If the variable is a factor, the factor levels will be displayed. If the variable is numeric or character, the unique values will be printed up to the sixth one.
The user-defined missing values for factor variables will be as text strings. For the numeric variables these will be integers, followed by their labels in brackets.
If a full file path is provided to the out.file
, the same output will be written to a .txt
file with a text on top which data file/object was used.
See Also
lsa.convert.data
, lsa.recode.vars
Examples
# Display and write to file the dictionaries for multiple factor and numeric variables using
# PIRLS 2016 file with teacher and student data from several countries and open the file after
# it has been written to the disk.
## Not run:
lsa.vars.dict(data.file = "C:/temp/test.RData", var.names = c("ASBG10A", "ASBG10B", "ASBG05A",
"ASBG05B", "ASBG05C", "ASBG05D", "ASBG05E", "ASBG05F", "ASBG05G", "ASBG05H", "ASBG06",
"ASBG07A", "ASBG07B", "ASBG08", "ATBG05BA", "ATBG05BB", "ATBG05BC", "ATBG05BD"),
out.file = "C:/temp/dict.txt", open.out.file = TRUE)
## End(Not run)
## Not run:
lsa.vars.dict(data.object = test, var.names = c("ASBG10A", "ASBG10B", "ASBG05A", "ASBG05B",
"ASBG05C", "ASBG05D", "ASBG05E", "ASBG05F", "ASBG05G", "ASBG05H","ASBG06", "ASBG07A",
"ASBG07B", "ASBG08", "ATBG05BA", "ATBG05BB", "ATBG05BC", "ATBG05BD"),
out.file = "C:/temp/dict.txt", open.out.file = TRUE)
## End(Not run)