Error in R Markdown: Data must be a character vector

is a syuzhet function with a signature

get_nrc_sentiment(char_v, cl = NULL, language = "english", lowercase = TRUE)

where char_v is a character vector, e.g.

c("alpha", "beta")

The function is being given as char_v AttdAI,which is the return value of from the textreg package. As noted in it's documentation

sometimes you need to convert your tm object to a string vector for various reasons, the main one being handing it to the C++ method. It is ugly, \dots
It is therefore a possibly better decision to pass a filename to a plain-text file to the textreg call to be loaded by C++ directly. See textreg

which indicates that get_nrc_sentiment may fail, there is an alternative and suggests that it is not worthwhile attempting to find why it might work in the console but not in the rendering.

Please see the FAQ on cross posting.