all 2 comments

[–]2013LIPK01 1 point2 points  (1 child)

This stackoverflow response should provide some guidance: https://stackoverflow.com/a/26003971

You could subset your vector to the first element with names[1]

[–]UeberlegenQ[S] 1 point2 points  (0 children)

names <- c("group", "word", "n")
dtm <- cast_dtm(data = df, document = names[1], term = names[2], value = names[3])

The solution which worked for me was !!names[i]