【发布时间】:2020-12-07 04:55:36
【问题描述】:
研究背景:“听众”发表他们的想法,“演讲者”对听众做出反应。每个线程的第一个观察到的侦听器是原始帖子作者。
示例数据:
structure(list(topic = c(1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2), thread = c(1,
1, 1, 2, 2, 2, 3, 3, 3, 3, 3), listener_id = c(111, 111, 333,
222, 222, 222, 444, 444, 777, 444, 444), speaker_id = c(222,
333, 111, 111, 555, 444, 222, 777, 444, 333, 777), speaker_response = c(3,
3, 6, 1, 4, 4, 4, 2, 2, 5, 3)), class = "data.frame", row.names = c(NA,
-11L), codepage = 65001L)
在表格中,它看起来像:
╔═══════╦════════╦═════════════╦════════════╦══════════════════╗
║ topic ║ thread ║ listener_id ║ speaker_id ║ speaker_response ║
╠═══════╬════════╬═════════════╬════════════╬══════════════════╣
║ 1.00 ║ 1 ║ 111 ║ 222 ║ 3 ║
╠═══════╬════════╬═════════════╬════════════╬══════════════════╣
║ 1.00 ║ 1 ║ 111 ║ 333 ║ 3 ║
╠═══════╬════════╬═════════════╬════════════╬══════════════════╣
║ 1.00 ║ 1 ║ 333 ║ 111 ║ 6 ║
╠═══════╬════════╬═════════════╬════════════╬══════════════════╣
║ 1.00 ║ 2 ║ 222 ║ 111 ║ 1 ║
╠═══════╬════════╬═════════════╬════════════╬══════════════════╣
║ 1.00 ║ 2 ║ 222 ║ 555 ║ 4 ║
╠═══════╬════════╬═════════════╬════════════╬══════════════════╣
║ 1.00 ║ 2 ║ 222 ║ 444 ║ 4 ║
╠═══════╬════════╬═════════════╬════════════╬══════════════════╣
║ 2.00 ║ 3 ║ 444 ║ 222 ║ 4 ║
╠═══════╬════════╬═════════════╬════════════╬══════════════════╣
║ 2.00 ║ 3 ║ 444 ║ 777 ║ 2 ║
╠═══════╬════════╬═════════════╬════════════╬══════════════════╣
║ 2.00 ║ 3 ║ 777 ║ 444 ║ 2 ║
╠═══════╬════════╬═════════════╬════════════╬══════════════════╣
║ 2.00 ║ 3 ║ 444 ║ 333 ║ 5 ║
╠═══════╬════════╬═════════════╬════════════╬══════════════════╣
║ 2.00 ║ 3 ║ 111 ║ 777 ║ 3 ║
╚═══════╩════════╩═════════════╩════════════╩══════════════════╝
目标是:
- 按主题内每个线程的第一个听众对演讲者(而不是焦点听众依次做出的回应)的平均响应质量进行汇总。
这在文字上可能会令人困惑; 可视化,最终结果看起来像:
╔═══════╦════════╦═════════════╦═════════════════╦══════════════════════════════════════════╗
║ topic ║ thread ║ listener_id ║ others_response ║ explanation ║
╠═══════╬════════╬═════════════╬═════════════════╬══════════════════════════════════════════╣
║ 1 ║ 1 ║ 111 ║ 3 ║ Here, the first listener was 111 ║
║ ║ ║ ║ ║ and others' average response = (3+3)/2, ║
║ ║ ║ ║ ║ excluding the last observation where 111 ║
║ ║ ║ ║ ║ was the speaker. ║
╠═══════╬════════╬═════════════╬═════════════════╬══════════════════════════════════════════╣
║ 1 ║ 2 ║ 222 ║ 3 ║ ║
╠═══════╬════════╬═════════════╬═════════════════╬══════════════════════════════════════════╣
║ 2 ║ 3 ║ 444 ║ 3.5 ║ Excluding the response made by the first ║
║ ║ ║ ║ ║ listener, the average is (4+2+5+3)/4. ║
╚═══════╩════════╩═════════════╩═════════════════╩══════════════════════════════════════════╝
【问题讨论】: