vis_response_counts: vis_response_counts

Description Usage Arguments Value Examples

View source: R/SL_tbl_explore.R

Description

Produce an ordered bar plot of the total number of responses for each student in a regularised SL_tbl.

Usage

1
2
3
4
5
6
7
8
vis_response_counts(
  tab,
  response,
  main = paste0("Total responses by student (", attr(tab, "table"), ")"),
  xlab = "Student UID",
  ylab = "Response count",
  ...
)

Arguments

tab

A regularised StudentLife tibble (i.e., an object of class reg_SL_tbl) as produced by the function regularise_time.

response

A character string naming one of the columns in tab that is not in attr(tab, "blocks"). If missing then this defaults to the first such column name.

main

The plot title, passed to barplot.

xlab

The x axis label, passed to barplot.

ylab

The y axis label, passed to barplot.

...

Arguments passed to barplot.

Value

A named numeric vector of response counts, sorted in descending order.

Examples

1
2
3
4
5
6
7
8
9
d <- tempdir()
download_studentlife(location = d, url = "testdata")

tab_PAM <- load_SL_tibble(schema = "EMA", table = "PAM", location = d)

reg_PAM <- regularise_time(
  tab_PAM, blocks = c("day", "epoch"), m = mean(picture_idx, na.rm = TRUE))

vis_response_counts(reg_PAM, response = "m")

studentlife documentation built on Nov. 1, 2020, 9:07 a.m.