-
Notifications
You must be signed in to change notification settings - Fork 20
Source Code Layout
These are the source code files which are contained in the R/ folder. Each of the files and its contents are described below.
comment_coding.Rdata.Rhelper_functions.Rhtml_results.Rloading_results.Rpandoc_conversion.Rquestion_type_checking.Rreorganizing_survey_data.Rresults_generation.R
The functions contained in comment_coding.R are written for users to import CSV and XLSX sheets which categorize the raw text comments of a survey and include them as "Coded Comments" tables in the Text Appendices portion of the generated report.
directory_get_coded_comment_sheetsget_coded_comment_sheetformat_coded_commentsformat_coded_comment_sheetsmerge_split_column_into_comment_sheetformat_and_split_comment_sheetsinsert_coded_commentsinsert_split_survey_commentsgenerate_split_coded_comments
This file does not contain any functions, but rather provides the names of the data files which should be imported from the data/ folder. This includes some sample data for testing.
The helper functions contained in this file are functions which are relied
upon by many functions found in different parts of the application. The
functions app and get_setup are two functions which users will regularly
encounter. Functions such as question_from_response_column, find_question,
find_question_index, find_question_index_by_qid, and others are functions
which lookup values or indices corresponding to their inputs and are relied
upon in the application to find where data should be sourced from or inserted into.
list_of_rows_to_dfquestion_from_response_columnchoice_text_from_questionappget_setupfind_questionfind_question_indexfind_question_index_by_qidchoice_text_from_response_columnblocks_header_to_htmlnumber_of_blocksquestions_from_blocksflow_from_survey
The QualtricsTools application builds reports in HTML before rendering them
into other formats with Pandoc. The functions contained in this file are those
which help in rendering the HTML reports seen in the Shiny app. tabelize_blocks, text_appendices_table, and tabelize_display_logic are the most critical
functions in this file, and they produce the Results Tables, Text Appendices, and Survey Logic reports.
tabelize_blocksquestion_descriptionhas_display_logictext_appendices_tableuncodeable_questions_messagetabelize_display_logicappendix_letteringtable_html_coded_commentstable_no_respondentstable_text_entrytable_non_text_entry
These are functions which are used to import Qualtrics survey data in a standardized way, as well as to provide a graphical interface to choose the data to be loaded. validate_data_export_tags ensures that the Qualtrics Survey File uploaded does not have any duplicate data export tags.
load_csv_dataload_qsf_dataask_for_qsfask_for_csvvalidate_data_export_tags
The data which is produced in html_results.R is passed to this single
function, with parameters including the desired output extension and
desired output file name. html_2_pandoc then uses system calls to Pandoc
to convert the file (in temporary memory) and then moves it to the desired
output location.
html_2_pandoc
An integral part of the results generation is the tabling of frequencies of responses and choices to a given question. Depending on the question's format, these frequencies need to be tabled differently. In order to reliably detect what format a given question is, the following functions are used, which each return boolean values indicating the type of a question provided as an argument.
is_mc_multiple_answeris_matrix_multiple_answeris_mc_single_answeris_matrix_single_answeris_matrix_bipolaris_multiple_choiceis_single_answeris_rank_orderis_text_entryis_matrix_question
Qualtrics provides its survey and response data separately, as a QSF and CSV file which
can be downloaded. However, the QualtricsTools application often needs the context of
the data which is included in both and therefore the following functions have been
built to reorganize and combine survey data into structures more usable in R.
Firstly, the response data is linked to its corresponding question with
link_responses_to_questions. Additionally, Qualtrics lists questions and
blocks as top level elements in the SurveyElements list in the QSF, and
then lists within the blocks the IDs of questions included in each block.
blocks_from_survey, questions_from_survey, questions_into_blocks,
and others handle extracting this data and integrating it into single lists
which contain, for example, all blocks with all questions inserted into them,
or all questions in a list with nothing else.
get_coded_questions_and_blocksblocks_from_surveynotes_from_surveyinsert_notes_into_questionsquestions_from_survey-
remove_trash_questionsdelete_if_in_trash
remove_trash_blockslink_responses_to_questionsquestions_into_blocks-
clean_question_textremove_css_style
-
clean_htmlclean_html_tagsclean_html_entitiesclean_extra_whitespaceclean_leading_whitespace
-
human_readable_qtypecreate_qtype
-
create_question_dictionarycreate_entry
uncodeable_question_dictionary-
lean_responsescreate_entry
answers_from_response_columnsplit_side_by_sidesdisplay_logic_from_questionsplit_respondents-
create_response_column_dictionarycreate_entry
create_panel_datacreate_merged_response_column
These functions do the frequency tabling for the given question types. Included in these functions is functionality to look up the "choice text" which corresponds to a response's variable value (depending on things like "RecodedValues," "Choices", "Answers", and so forth), as well as logic which dictates how the frequencies for each response should be tabulated. Finally, the results of gathering this data are then tabled in a data frame which is returned.
percent0mc_single_answer_resultsmc_multiple_answer_resultsmatrix_single_answer_resultsmatrix_multiple_answer_resultsrename_choicesgenerate_results