Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- txt <- c("peter likes red", "mary likes green", "bob likes blue")
- voc <- c("peter", "mary", "bob", "red", "green", "blue")
- c("peter red", "mary green", "bob blue")
- foo <- VCorpus(VectorSource(txt))
- inspect(DocumentTermMatrix(foo, list(dictionary = voc)))
- Non-/sparse entries: 6/12
- Sparsity : 67%
- Maximal term length: 5
- Weighting : term frequency (tf)
- Terms
- Docs blue bob green mary peter red
- 1 0 0 0 0 1 1
- 2 0 0 1 1 0 0
- 3 1 1 0 0 0 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement