Cannot use := to add columns to a null data.table (no columns),
hack-r opened this issue · 2 comments
hack-r commented
What sets this off?
Some of values in the input character vector may be empty, is that not allowed?
pos_tags.q2 <- mapply(article.id = 1:length(text.q2.clean), content = text.q2.clean, FUN=function(article.id, content){
+ out <- (x = content, language = "english", core = TRUE)
+ out$article.id <- rep(article.id, times = nrow(out))
+ out
+ }, SIMPLIFY = FALSE)
Hide Traceback
Rerun with Debug
Error in `[<-.data.table`(x, j = name, value = value) :
Cannot use := to add columns to a null data.table (no columns), currently. You can use := to add (empty) columns to a 0-row data.table (1 or more empty columns), though.
6.
`[<-.data.table`(x, j = name, value = value)
5.
`$<-.data.table`(`*tmp*`, "word.id", value = integer(0))
4.
`$<-`(`*tmp*`, "word.id", value = integer(0))
3.
pattern_pos(x = content, language = "english", core = TRUE)
2.
(function (article.id, content)
{
out <- pattern_pos(x = content, language = "english", core = TRUE)
out$article.id <- rep(article.id, times = nrow(out)) ...
1.
mapply(article.id = 1:length(text.q2.clean), content = text.q2.clean,
FUN = function(article.id, content) {
out <- pattern_pos(x = content, language = "english",
core = TRUE) ...
hack-r commented
I have determined that this is caused by empty strings. It would be nice to add some handling for this.
hack-r commented
CLARIFICATION:
It turns out that the specific culprit is " " not "". Just FYI. I may do a pull request to give you some handling for this R-Python mapping.