We developed an R package named “SurveyDefense” to analyze and clean the collected data. This package enables the analysis and cleaning of the data using fraud detection questions.

The R package provides both a Word table and HTML output containing key metrics related to the resulting sub-datasets (i.e., cleaned dataset and fraudulent dataset)  and the impact of data cleaning on selected questions.

How to use the R Script

Survey Defense provides five fraud detection questions for the researcher to insert in their online survey that uses panel sample.

  1. Download the R package titled “SurveyDefense” from your local CRAN library. 

  2. The SurveyDefense package will ask that you import all of the survey data into R. 

  3. Option 1: The researcher can either label the Fraud Detection questions in the dataset as “Fraud1”, “Fraud2,” etc. and all of the remaining questions in the dataset as Q1, Q2, Q3, etc.  The script will operate as it is currently written in R.  

  4. Option 2: Alternatively, the researcher can change the R script with the variable names in the researcher’s dataset. For instance, “Fraud1” in the R-script can be changed to match the variable name in your dataset (i.e., Q26).