Codebooks
A codebook is an example of data-level metadata.
The purpose of a codebook or data dictionary is to explain what all the variable names and values in your spreadsheet really mean.
Information to include in a codebook includes:
- Variable Names
- Readable Variable Name
- Measurement Units
- Allowed Values
- Definition Of The Variable
- Synonyms For The Variable Name (Optional)
- Description Of The Variable (Optional)
- Other Resources
See: https://help.osf.io/article/217-how-to-make-a-data-dictionary
codebook R package
library(qualtRics)
library(readr)
library(dplyr)
library(codebook)
library(writexl)
surveys <- all_surveys()
survey_results <- fetch_survey(surveyID = surveys$id[2], # you can also replace surveys$id[2] with "<SUVREY-ID>"
verbose = TRUE)
survey_results <- select(survey_results, -c(1:17))
# survey_questions() retrieves a data frame containing questions and question IDs for a survey;
survey_questions <- survey_questions(surveyID = surveys$id[2])
survey_questions <- select(survey_questions, -c(1, 4))
survey_questions <- slice(survey_questions, -1)
# generate codebook
codebook <- codebook_table(survey_results)
codebook <- rename(codebook, qname = name)
codebook <- full_join(survey_questions, codebook, by = "qname")
write_xlsx(codebook, "documentation/codebook-demo.xlsx")
Last update:
2023-02-16 11:08:17