A Shoddy Survey Company

Prologue

Finally. The survey company you hired (Survey Company International) just mailed you the raw data.[1]

You came a long way. You secured funding for your research project/thesis, presented it to your supervisors, did a systematic review, wrote the theory section, and designed the questionnaire.

Now, the exciting part begins.

You unzip the folder, and there it is, the precious file you need so desperately…

… In .xlsx. “Huh?” You asked explicitly for a more robust file type.

But, alas, maybe they misread the e-mail, and at least it’s not stored in .xls.

“Thanks to R’s extensive importing capabilities, that’s no issue at all,” you say to yourself.

“It’s not like they messed up data collection; it’s just stored as .xlsx”.

You click on the file.

“Nevermind.”



[1] Name made up.

Some notes on the data

  • \(N = 500\)

  • This is not an actual data set. It was simulated with R.

  • It’s a “panel” survey consisting of three waves in April, May, and June.

  • “id_x” is the respondent identfier.

  • The survey consists of two questions named q1 and q2.

Tasks

  1. Read-in the data.

  2. Tidy the data.

  3. For each date, calculate the mean of q1 and q2.

  4. Manually generate a frequency table for q1 and q2, grouped by date.

If you put out your document to html, explore DT::datatable() for some interactivity!

You do not need to manipulate the Excel file manually to complete these tasks.

Hints

Look up ?rio::import_list and the here package. I normalized the directory in the knitr setup of this .Rmd file such that relative file paths from the project root should work (but this depends on the OS).

You will likely practice a key skill for your career as empirical researcher/ data scientist: googling. That’s normal!

Start Wrangling!