Skip to contents

surveyorso is an R package providing a unified toolkit for end-to-end survey research workflows.

It is designed for applied survey analysts who want fast, consistent, and reproducible ways to clean data, manage metadata, tabulate results, run advanced analytics, and prepare outputs for reporting, with built-in support for SPSS-style metadata such as data types, variable labels, and value levels.

Installation

Install from GitHub using remotes:

install.packages("remotes")
remotes::install_github("giobuzala/surveyorso")

Alternatively, install using pak:

install.packages("pak")
pak::pak("giobuzala/surveyorso")

Functions

Tabulation

Tracking

Statistical

Segmentation

Data quality

Open-ended coding

This package supports both:

To use the AI-assisted functions, set your OpenAI API key in the current R session or store it in a local .Renviron file for persistent use.

# Set your OpenAI API key in the current R session
Sys.setenv(OPENAI_API_KEY="your_api_key")

# 1) Create a draft theme list
theme_list <- theme_gpt(survey_data, x = Q5)

# 2a) Code responses and append binary-coded variables directly to the dataset
survey_data_coded <- code_gpt(survey_data, x = Q5, theme_list = theme_list) %>%
  code_gpt_to_df()

# 2b) Or write codes into an Excel coding workbook created by export_coding() for human review
code_gpt(survey_data, x = Q5, theme_list = theme_list) %>%
  code_gpt_to_excel(path = "Data")

Miscellaneous

Documentation

All functions are documented with examples using roxygen2. Browse help pages such as ?tab, ?standardize, ?strline, and ?code_gpt.