Generating Results Tables - tufts-oir/QualtricsTools GitHub Wiki
Results Tables on the Command Line
If you would like to write a script, or simply use R rather than the QualtricsTools app, then you can use the functions which are built into the QualtricsTools package to process a Qualtrics Survey File and its response data automatically. The following code snippets show different ways to process results tables. Depending on the level of interactivity necessary, different methods will be better for each individual's needs.
The last example makes use of the Survey Flow. If you would like to avoid using it, simply
do not define flow
, and do not pass it as an argument to create_html_results_table
.
make_results_tables
Generating with # If not passed arguments, get_setup prompts the user for them,
# and make_results will automatically pull them from the global scope.
get_setup()
make_results_tables(output_dir='C:/Example/Path/Here/')
# Alternatively every argument can be made explicit.
make_results_tables(qsf_path = 'C:/Example/Path/to/QSF_file.qsf',
csv_path = 'C:/Example/Path/to/CSV_file.csv',
headerrows = 3,
output_dir = 'C:/Example/Output Directory/Path',
filename = 'Surveyname Results Tables.docx')
If make_results_tables
is not passed a qsf_path, csv_path, and headerrows, it automatically pulls them from the global scope. This means that you may use get_setup()
to import a survey, edit its questions and other details, and then use
make_results_tables
after editing to render edited results tables.
If you use make_results_tables
before loading a survey without specifying a qsf_path and csv_path, you will be promoted to select your survey qsf and response file.
get_setup
Generating Results Tables with # Import Survey Data
get_setup(
qsf_path='C:/Example/Path/Sample_Survey.qsf',
csv_path='C:/Example/Path/Sample_Survey.csv',
headerrows=3
)
# Output Formatted Report
output_dir = 'C:/Example/Output Directory/Path'
html_2_pandoc(
html=c(blocks_header_to_html(blocks), create_html_results_tables(blocks, flow)),
file_name='sample survey results tables.docx',
output_dir=output_dir
)
get_setup
Generating Results Tables without This is more advanced and not recommended if your primary objective is to make standard results tables or appendices. However, it can provide more flexibility and customization options. If you are interested in generating results tables without using get_setup, look at the steps make_results_tables and get_reorganized_questions_and_blocks to see the steps taken for setup and tabling HTML results.