Неожиданный символ в лапе - PullRequest
0 голосов
/ 14 февраля 2019

Я пытаюсь запустить пример с фиктивными данными:

library(quanteda.dictionaries)
library(quanteda) 
 #dummy data
 df <- data.frame(text = c("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.", "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.", "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown inter took a galley of type and scrambled it t make a type specimen book."))

Использование lapply вместо цикла for для сокращения времени выполнения

df_list <- lapply(df$text, function(txt) {
     tryCatch({
         out <- liwcalike(txt, dictionary = data_dictionary_NRC)
         return(data.frame(em1=out$trust, em2=out$anger, origin=txt, error=NA))
     }, error = function(e) 
         data.frame(em1=NA, em2=NA, origin=txt, error=e)
     )
 }

final_df <- do.call(rbind, df_list)

Однако я получаю эту ошибку

Error: unexpected symbol in:
"
final_df

Что можно исправить в процессе?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...