sse-r-plugin
sse-r-plugin copied to clipboard
object of type 'closure' is not subsettable
Description
Connector reply error: grpc::StatusCode::INVALID_ARGUMENT: 'Status(StatusCode=InvalidArgument, Detail="Rserve error: Error in q$processCode : object of type 'closure' is not subsettable ")'
Steps to Reproduce
In the data load editor of the App, I put the following script:
Load
Cod as processCode,
Sistema as subcategoriaDoServico,
word,
word_latin1,
word_utf8,
word_utf8 as check_word1
Extension R.ScriptEval('
rm(list=ls());
options(encoding = "UTF-8");
library(dplyr);
library(rvest);
library(tidyr);
library(NLP);
library(tidytext);
library(stringi);
library(stringr);
clean_text <- function(text){
text <- gsub("[c]\\(", " ", text)
text <- gsub("@\\w+", "", text)
text <- gsub("https?://.+", "", text)
text <- gsub("#\\w+", "", text)
text <- gsub("[[:punct:]]", " ", text)
text <- gsub("\n", " ", text)
text <- gsub("^\\s+", "", text)
text <- gsub("\\s+$", "", text)
text <- gsub("[ |\t]+", " ", text)
text <- str_replace_all(text, "NaN", "")
return(text)
};
dfchamados <- data.frame(Cod = q$processCode, Item = q$servico, Sistema = q$subcategoriaDoServico, Titulo = q$Titulo, Descricao = q$Descricao);
text <- paste(dfchamados$Descricao, dfchamados$Titulo) %>% as.character();
text <- iconv(text,"UTF-8","LATIN1")
text <- clean_text(text);
dfchamados$fix_text <- text;
dfchamados %>%
select(Cod, Sistema, fix_text) %>%
unnest_tokens(input = fix_text, output = word) -> tidy_text;
tidy_text$word_latin1 <- iconv(tidy_text$word,"UTF-8","LATIN1");
tidy_text$word_utf8 <- iconv(tidy_text$word,"LATIN1","UTF-8");
print(paste0("nrows tidy_text_teor_chamado: ", nrow(tidy_text)));
tidy_text;',
slas{processCode, servico, subcategoriaDoServico, Titulo, Descricao}
);
Actual behavior
Got this error:
Error in q$processCode : object of type 'closure' is not subsettable 1: data.frame(Cod = q$processCode, Item = q$servico, Sistema = q$subcategoriaDoServico, Titulo = q$Titulo, Descricao = q$Descricao)