Skip to content

Instantly share code, notes, and snippets.

@juliasilge
Created August 28, 2019 01:31
Show Gist options
  • Save juliasilge/dbd94230163f71c6c4b4ced98c3cef39 to your computer and use it in GitHub Desktop.
Save juliasilge/dbd94230163f71c6c4b4ced98c3cef39 to your computer and use it in GitHub Desktop.
For Johan Braeken
library(tidyverse)
library(tidytext)
dat <- tibble(
a = c("row1", "row1", "row2", "row2", "row2"),
b = c("col1", "col2", "col1", "col3", "col4"),
val = 1:5
)
d <- cast_dtm(dat, a, b, val)
as.matrix(d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment