ExitPoll
Use c3d_exitpoll() to fetch response count data for ExitPoll surveys in your project. Each row in the returned tibble represents one response option for one question in one survey version, making it easy to compute response distributions.
Function Signature
c3d_exitpoll(
project_id = NULL,
hook = NULL,
version = NULL,
exclude_test = TRUE,
exclude_idle = TRUE,
start_date = NULL,
end_date = NULL
)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
project_id |
Integer | from c3d_project() |
Cognitive3D project ID |
hook |
Character | NULL |
Filter to a specific survey hook name |
version |
Integer | NULL |
Filter to a specific survey version number |
exclude_test |
Logical | TRUE |
Filter out sessions tagged as test |
exclude_idle |
Logical | TRUE |
Filter out sessions tagged as junk or idle |
start_date |
Date / string | NULL |
Start of the date range ("YYYY-MM-DD") |
end_date |
Date / string | NULL |
End of the date range ("YYYY-MM-DD") |
Note
Unlike other functions in this package, c3d_exitpoll() does not default to a 30-day window when no date range is provided. Omitting start_date and end_date returns all-time data.
Output Columns
| Column | Description |
|---|---|
hook |
Survey hook name |
version |
Survey version number |
question_index |
Zero-based position of the question within the survey |
question_title |
Text of the question |
question_type |
Question type (see below) |
value |
Raw response value |
value_label |
Human-readable label for the response value |
count |
Number of respondents who selected this option |
One row is returned per response option per question per version. Skipped responses appear with value = "skipped" and value_label = "skipped".
Question Types and Value Labels
| Question Type | Value | Label |
|---|---|---|
boolean |
"0" |
"False" |
boolean |
"1" |
"True" |
happysad |
"0" |
"Sad" |
happysad |
"1" |
"Happy" |
thumbs |
"0" |
"Down" |
thumbs |
"1" |
"Up" |
voice |
"0" |
"Responded" |
multiple |
varies | answer text from survey metadata |
scale |
varies | raw value (no mapping applied) |
Examples
# All ExitPoll data, all time
polls <- c3d_exitpoll()
# Filter to a specific hook
polls <- c3d_exitpoll(hook = "end_questions")
# Specific hook, specific version, with date filter
polls <- c3d_exitpoll(
hook = "end_questions",
version = 3,
start_date = "2025-01-01"
)
# All data from a date range
polls <- c3d_exitpoll(
start_date = "2025-01-01",
end_date = "2025-06-01"
)
Working with ExitPoll Data
The long format of the output makes it easy to compute percentages and visualize distributions:
library(dplyr)
library(ggplot2)
polls <- c3d_exitpoll(hook = "end_questions")
# Compute response proportions per question
polls |>
group_by(question_title) |>
mutate(pct = count / sum(count)) |>
select(question_title, value_label, count, pct)
# Bar chart of responses for a single question
polls |>
filter(question_title == "How comfortable did you feel?") |>
ggplot(aes(x = value_label, y = count)) +
geom_col() +
labs(title = "Comfort question responses")
If you have a question or any feedback about our documentation please use the Intercom button (purple circle) in the lower right corner of any web page or join our Discord.