inst/doc/v04_icr.R

## ---- include = FALSE---------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----setup, message = FALSE, warning = FALSE, include = FALSE-----------------
library(tidycomm)

## -----------------------------------------------------------------------------
fbposts

## -----------------------------------------------------------------------------
fbposts %>% 
  test_icr(post_id, coder_id, pop_elite, pop_people, pop_othering)

## -----------------------------------------------------------------------------
fbposts %>% 
  test_icr(post_id, coder_id)

## -----------------------------------------------------------------------------
fbposts %>% 
  test_icr(post_id, coder_id, fleiss_kappa = TRUE, agreement = FALSE)

## -----------------------------------------------------------------------------
fbposts %>% 
  test_icr(post_id, coder_id, levels = c(n_pictures = "ordinal"))

## -----------------------------------------------------------------------------
# Introduce some missing values
fbposts$type[1] <- NA
fbposts$type[2] <- NA
fbposts$pop_elite[5] <- NA

fbposts %>% 
  test_icr(post_id, coder_id)

## -----------------------------------------------------------------------------
fbposts %>% 
  test_icr(post_id, coder_id, na.omit = TRUE)

## -----------------------------------------------------------------------------
data <- tibble::tibble(
  unit = c(1, 1, 2, 2, 3, 3),
  coder = c('a', 'b', 'a', 'c', 'b', 'c'),
  code = c(1, 0, 1, 1, 0, 0)
)

data

## ----error=TRUE---------------------------------------------------------------
data %>%
  test_icr(unit, coder, code, na.omit = TRUE)

## -----------------------------------------------------------------------------
data %>% 
  dplyr::group_by(unit) %>% 
  dplyr::mutate(coding = 1:dplyr::n()) %>% 
  dplyr::ungroup() %>% 
  test_icr(unit, coding, code)

Try the tidycomm package in your browser

Any scripts or data that you put into this service are public.

tidycomm documentation built on July 6, 2021, 5:07 p.m.