Introduction

This is a vignette of how to use the teachAnxiety package and it's functions to process data collected using the Parson's (1973) Teaching Anxiety Instrument. This markdown can be used as a reference for survey data processing in preparation for subsequent analyses.

Initial steps

We will use a variety of packages and sets of packages, in which teachAnxiety functions rely on. These include:dplyr, devtools, readr and readxl. Technically, these packages do not need to be loaded with library(), however, as they have been included as dependencies within the package itself.

Now, if you haven't already, we want to make sure to install the teachAnxiety package from github:

devtools::install_github("miranda-chen/teachAnxiety")
library(teachAnxiety)

1) Read practice data from package test_data.csv

Let's begin by reading in the external data provided within the package and check to see if it is read correctly:

filepath <- system.file("extdata/", "test_data.csv", package = "teachAnxiety")
practice_dataset <- read.csv(filepath)
practice_dataset

2) Check data format to read in .xlsx and .csv files

When using your own data, you can use the check_data_format() function to make sure the data being processed using this package is a .csv or .xlsx file. If it is a .csv or .xlsx file, the data will be read by R properly and present the dataframe.

read_survey(filepath) 

Within read_survey(), there are two wrapper functions to more easily read .csv or .xlsx files: read_survey_results_csv() and read_survey_results_xlsx(). These wrappers make sure the data can actually be read by R, and provides a meaningful error message otherwise.

read_survey_results_csv(filepath) 
# Again, if it is a .csv file, the data will be read by R properly and present the dataframe

For the sake of demonstration, if we put the given .csv file into the read_survey_results_xlsx(), an error message will appear:

read_survey_results_xlsx(filepath)

3) Are my data numeric or not?

Next, we want to check to see if our data are being read as numeric values by R. This will be important for subsequent data analysis!

numeric_columns(practice_dataset)

From the output, you can see that it is TRUE in all our columns of the practice_dataset, that it only has numeric data. If you find that there are columns that come out FALSE, then you need to to back into your dataset to see how R is reading that data.

4) Got NAs, anyone?

The next function in the package tests to see if there are NAs (from incomplete responses from participants) within the dataset.

contains.na(practice_dataset)

Here, we see that it is TRUE in this practice_dataset there are is an NA value in column 2. In this way, users can assess how many NAs they have and determine how they want to proceed with those NAs (e.g. fill them with averages, take out the participant row, etc.).

5) Calculate the Teaching Anxiety Score

Finally, the function to actually calculate the Teaching Anxiety Score as presented in the Parson's 1973 instrument. This function does two things: (1) reverse scores 14 questions, and (2) sums all columns for each row/participant to calculate an Anxiety Score.

teach_anxiety(practice_dataset)

In the last column, you can see the calculated teaching anxiety score for each row participant. The data is ready to be further analyzed (e.g connected to other data for participants, develop models, etc.).

Conclusion

This package hold simple functions for users to better process their survey data from Parson's (1973) survey. Pleaserefer to https://github.com/miranda-chen/teachAnxiety.git for further details about the code.



miranda-chen/teachAnxiety documentation built on Dec. 24, 2019, 4:32 a.m.