我进行了一项心理实验,我想分析参与者的时钟监控频率。我想按5秒的时间块查找平均时钟检查次数。然后最好做一个散点图,看看时钟检查装置的分布是否因价而异。 有什么建议吗?
这是我数据的一部分...
tibble::tribble(
~Valence, ~CheckTime, ~Participant,
0, 44.4, 1L,
1, 7, 2L,
2, 15.9, 3L,
0, 35, 1L,
1, 27.4, 2L,
2, 30.4, 3L,
0, 56.9, 1L,
1, 45.7, 2L,
2, 40.4, 3L,
0, 40.8, 1L,
1, 50.9, 2L,
2, 48, 3L,
0, 60, 1L,
1, 55.4, 2L,
2, 20, 3L,
0, 23.4, 1L,
1, 10.9, 2L,
2, 37.6, 3L,
0, 47.4, 1L,
1, 27.4, 2L,
2, 57.4, 3L,
0, 61, 1L,
1, 47.4, 2L,
2, 37, 3L,
0, 35.2, 1L,
1, 55.4, 2L,
2, 53.9, 3L,
0, 54, 1L,
1, 1.5, 2L,
2, 36.1, 3L,
0, 30.4, 1L,
1, 8.9, 2L,
2, 58.6, 3L,
0, 58.7, 1L,
1, 20.6, 2L,
2, 45.9, 3L,
0, 81.5, 1L,
1, 26.9, 2L,
2, 54.6, 3L,
0, 26.2, 1L,
1, 44.5, 2L,
2, 47.4, 3L,
0, 52, 1L,
1, 51.5, 2L,
2, 62.1, 3L,
0, 38.7, 1L,
1, 54.3, 2L,
2, 39.5, 3L,
0, 60, 1L,
1, 24, 2L,
2, 58.4, 3L,
0, 21.1, 1L,
1, 39, 2L,
2, 58.9, 3L,
0, 65.2, 1L,
1, 49.4, 2L,
2, 54.2, 3L,
0, 30.4, 1L,
1, 56.6, 2L,
2, 40.5, 3L,
0, 50.3, 1L,
1, 0.8, 2L,
2, 51.8, 3L,
0, 60.3, 1L,
1, 16.7, 2L,
2, 37.9, 3L,
0, 18.7, 1L,
1, 41.8, 2L,
2, 53.6, 3L,
0, 33.8, 1L,
1, 49.4, 2L,
2, 36.2, 3L,
0, 49, 1L,
1, 53.5, 2L,
2, 59.5, 3L,
0, 61.4, 1L,
1, 1.4, 2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, 53.6, 2L,
1, 0.7, 2L,
1, 16.6, 2L,
1, 33.5, 2L,
1, 49.6, 2L,
1, 59.4, 2L,
1, 12.9, 2L,
1, 23.3, 2L,
1, 36, 2L,
1, 40.9, 2L,
1, 50.4, 2L,
1, 53.6, 2L,
1, 0.8, 2L,
1, 19.9, 2L,
1, 32.6, 2L,
1, 62, 2L,
1, 0.6, 2L,
1, 8.7, 2L,
1, 45.2, 2L,
1, 56.6, 2L,
1, 2.1, 2L
)
编辑。
OP在下面对我的回答的评论中发布了以下代码。
library(ggplot2)
library(dplyr)
df1 %>%
select(Valence, CheckTime, Participant) %>% #interest variables
filter(!is.na(CheckTime)) %>% #deleting NAN
mutate(CheckTime = round(CheckTime, 0)) %>%
group_by( Valence, CheckTime) %>%
tally() %>%
ggplot(aes(x=CheckTime, y=n, color=factor(Valence))) +
geom_point() +
xlim(c(1,60)) +
geom_smooth(method = "lm") +
labs(title = element_blank(), x = "Check Time", y = "N", color = "Valence") +
scale_color_manual(labels = c("Neutral", "Positive", "Negative"),
values = c("red", "green", "blue"))