Closed lorenaromero86 closed 11 years ago
I'm not sure about the exact cause of your error as I don't have your data but I do know that the neg.words and pos.words are actually a list of vectors stored in a data.frame
object. Writing to csv/xlsx won't work with some sort of adjustment (i.e., collapsing to a single character string.). I added two non exported functions to the development version of qdap
as seen below:
library(qdap)
poldat <- with(DATA, polarity(state, person))
out1 <- merge(DATA, poldat$all, by.x=qcv(person, state), by.y=qcv(person, text.var))
paste3 <- function(x, sep = ", "){
sapply(x, paste, collapse = sep)
}
condense <- function(dataframe, ...) {
whichlist <- sapply(dataframe, is.list)
dataframe[, whichlist] <- sapply(dataframe[, whichlist], paste3, ...)
dataframe
}
library(xlsx)
## Notice the use of condense
write.xlsx(x = condense(out1), file = "out1.xls", sheetName = "out1", row.names = FALSE)
If you download the dev. vserion of qdap
you paste3
and condense
are nonexported functions you could access this way:
write.xlsx(x = qdap:::condense(out1), file = "out1.xls", sheetName = "out1", row.names = FALSE)
I decided to add condense as an exported function. You can use:
write.xlsx(x = condense(out1), file = "out1.xls", sheetName = "out1", row.names = FALSE)
after installing the dev version.
Hi, thanks a lot, it solved my problem! as it would be said in spanish: eres un sol! (you are a sunshine!).
Glad I could help.
You did well with the GitHub report and as you can see it emails you and I both of notifications. Let's learn a little more about GitHub. If your problem has been solved you can close it. Try it out.
Trinker, you are the best, this post helped me a great deal!
Hi, I used your package to run some polarity analysis in tweets, but when trying to export the data to excel I am getting errors, can you please help me to know what I am doing wrong? below the code I am trying to run (in windows 7)
Tks.
After this what I get is: