Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in if (!is.null(texts) && length(texts) != nrow(theta)) stop("Number of provided texts and number of documents modeled do not match") : missing value where TRUE/FALSE needed #268

Open
michaelGRU opened this issue Jan 27, 2022 · 0 comments

Comments

@michaelGRU
Copy link

michaelGRU commented Jan 27, 2022

Hi I keep getting this error when I'm using findThoughts().
df is a data frame that contains text information and user ID.

This is my code

#stemming and stopword removal
processed <- textProcessor(df$tweet, metadata=df)

#structure and index the data for usage in the structural topic model
out <- prepDocuments(processed$documents, processed$vocab, processed$meta)

#save the output object meta, documents, and vocab into variables:
docs <- out$documents
vocab <- out$vocab
meta <- out$meta

poliblogPrevFit <- stm(out$documents, out$vocab, K=15, prevalence=~type,
                       max.em.its=75, data=out$meta, init.type="Spectral",
                       verbose = FALSE)

thoughts1 <- findThoughts(df, texts = as.character(out$meta$tweet), n = 1, topics = 4)$docs[[1]]

Error in if (!is.null(texts) && length(texts) != nrow(theta)) stop("Number of provided texts and number of documents modeled do not match") :
missing value where TRUE/FALSE needed

It says "Your corpus now has 998 documents, 1761 terms and 14704 tokens."
length(out$meta$tweet) returns 998. The number of provided texts and the number of documents modeled do match, no?

Can give me a hint on what might be the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant