【问题标题】:dplyr mutate throws "Error: invalid subscript type 'closure'" errordplyr mutate 抛出“错误:无效的下标类型‘闭包’”错误
【发布时间】:2017-04-14 04:12:32
【问题描述】:

我正在尝试将 SentimentR 中的 Sentiment_by 与 dplyr 的变异一起使用

这例如有效: content <- mutate(content, word_count = sentiment_by(story)$word_count)

但是

这例如有效: content.sd <- mutate(content, word_count = sentiment_by(story)$sd)

给出错误错误:invalid subscript type 'closure'

sentiment_by(content$story[1]) 有效

任何帮助将不胜感激。

【问题讨论】:

  • sentiment_by(story)str() 是什么?

标签: r dplyr sentimentr


【解决方案1】:

你可以改用下面的

content <- mutate(content, stdev = sentiment_by(story)[["sd"]])

【讨论】:

    猜你喜欢
    • 2015-01-15
    • 2022-11-24
    • 1970-01-01
    • 2016-01-10
    • 1970-01-01
    • 1970-01-01
    • 2015-08-03
    • 1970-01-01
    • 2023-01-25
    相关资源
    最近更新 更多