我试图通过x轴的发育阶段在y轴上生成权重图。在每个发展阶段有几百个样本包含数据点,我试图从中提取增长率曲线。我不知道如何以x轴代表三个分类变量(“ColonyMass_At_Wrkr_Eclosion”,“ColonyMass_4wksLater”和“ColonyMass_2mnthsLater”)的方式绘制它,我也不知道如何为同一个人连接数据点跨变量(如果有意义的话,创建一系列曲线)。我使用dput()复制我的数据帧有些困难,但我已经尽力了。有什么建议?非常感谢你!:
just_growth_data=structure(list(ColonyMass_At_Wrkr_Eclosion = c(NA, 117L, NA,
53L, NA, 91L, 85L, 111L, 96L, NA, 112L, 90L, 112L, 120L, 110L,
109L, NA, NA, 99L, 86L, 108L, 109L, 87L, 108L, 116L, 137L, 108L,
NA, NA, NA, 93L, NA, 96L, 98L, 87L, NA, 111L, NA, 114L, NA, 11L,
123L, 113L, 130L, 134L, NA, NA, 96L, NA, NA, 15L, 74L, NA, NA,
75L, 96L, 88L, NA, 122L, NA, 101L, 83L, 123L, 89L, 85L, NA, 112L,
98L, 87L, 123L, 115L, 16L, 125L, NA, 91L, NA, 85L, 76L, 122L,
95L, 113L, 116L, 102L, 132L, 11L, 105L, 112L, 102L, 8L, NA, 113L,
NA, 93L, 104L, 119L, 116L, 112L, 77L, NA, NA, 105L, 105L, 41L,
99L, NA, 113L, 120L, 130L, 98L, 122L, 118L, NA, NA, 97L, NA,
NA, NA, 104L, 103L, 110L, 25L, 118L, 98L, 123L, NA, 97L, NA,
7L, 118L, NA, 82L, NA, 103L, 106L, 113L, NA, 115L, 123L, 124L,
38L, 26L, 102L, 90L, NA, 59L, 102L, 82L, 120L, 113L, 116L, 117L,
116L, 62L, 93L, 91L, 102L, 121L, 120L, NA, 111L, 97L, 63L, 109L,
113L, 102L, 125L, 102L, 111L, 123L, 52L, 72L, NA, NA, 116L, NA,
81L, 52L, 52L, NA, 105L, 123L, 87L, NA, 136L, 108L, NA, 120L,
122L, NA, NA, 126L, NA, 47L, 111L, 118L, NA, NA, NA, NA, 109L,
NA, 99L, 106L, 53L, 102L, 77L, 99L, NA, NA, NA, 114L, NA, 111L,
NA, 113L, NA, 76L, 114L, NA, 120L, 113L, 97L, 134L, 98L, 118L,
75L, 109L, 124L, 108L, NA, 124L, NA, 65L, 100L, NA, NA, 126L,
11L, 97L, 76L, NA, NA, 106L, 110L, 3L, 116L, NA, NA, 135L, 96L,
101L, NA, 92L, NA, NA, 118L, NA, 105L, 15L, 129L, 128L, 102L,
NA, 92L, 100L, NA, NA, 71L, 103L, NA, 113L, NA, NA, 63L, NA,
88L, 83L, 106L, 117L, 49L, NA, NA, 61L, 79L, NA, 91L, 102L, NA,
93L, NA, NA, NA, 87L, 126L, 99L, NA, NA, 100L, 116L, 103L, 87L,
37L, NA, 112L, NA, NA, 18L, NA, 94L, NA, NA, NA, 117L, 102L,
62L, 96L, NA, 87L, 8L, NA, 86L, 61L, NA, 68L, 117L, 89L, NA,
90L, NA, 104L, 94L, 102L, NA, 105L, 107L, 62L, 130L, 99L, 111L,
NA, 106L, 98L, NA, 140L, 88L, 94L, NA, 122L, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), ColonyMass_4wksLater = c(NA,
571L, NA, NA, NA, 736L, NA, NA, NA, NA, NA, 438L, NA, NA, 711L,
NA, NA, NA, 537L, NA, 844L, NA, NA, NA, 560L, 561L, NA, NA, NA,
NA, 594L, NA, NA, 457L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 714L,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 417L,
NA, NA, NA, 701L, NA, NA, NA, 25L, NA, NA, NA, NA, NA, NA, NA,
NA, NA, 866L, NA, NA, 291L, NA, 659L, 354L, 743L, NA, NA, 696L,
NA, NA, NA, NA, NA, NA, NA, 518L, NA, NA, NA, NA, NA, NA, 907L,
27L, NA, NA, 625L, NA, NA, 957L, 804L, NA, NA, NA, 650L, NA,
NA, NA, NA, NA, NA, NA, 699L, 632L, NA, NA, 518L, NA, NA, NA,
NA, NA, NA, 527L, 541L, NA, NA, NA, NA, NA, 448L, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 382L, NA, 431L, NA, 620L,
NA, 296L, NA, 532L, NA, 485L, NA, NA, NA, NA, NA, NA, 153L, NA,
NA, NA, NA, 23L, NA, NA, NA, 606L, NA, NA, NA, 550L, 766L, NA,
426L, 786L, NA, NA, 289L, NA, 119L, 327L, NA, NA, NA, NA, NA,
NA, NA, 602L, NA, 20L, NA, NA, NA, NA, NA, NA, 152L, NA, 592L,
NA, NA, NA, 1235L, 197L, NA, 442L, NA, NA, 558L, NA, NA, NA,
NA, 818L, NA, NA, NA, NA, NA, NA, NA, NA, 783L, NA, 519L, NA,
NA, NA, 856L, 609L, NA, 397L, NA, NA, 1195L, NA, 473L, NA, NA,
NA, NA, 370L, NA, NA, 3L, 561L, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, 783L, NA, NA, NA, NA, NA, NA, 537L, NA, NA, NA, NA, NA,
937L, NA, 696L, NA, NA, 859L, NA, NA, NA, NA, NA, NA, NA, NA,
NA, 902L, 430L, NA, 11L, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, 354L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 682L, NA,
NA, NA, NA, NA, 134L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 670L,
NA, NA, NA, NA, NA, NA, 537L, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), ColonyMass_2mnthsLater = c(NA,
445L, NA, NA, NA, 1817L, NA, NA, NA, NA, NA, 2683L, NA, NA, 1775L,
NA, NA, NA, 429L, NA, 77L, NA, NA, NA, 279L, 23L, NA, NA, NA,
NA, NA, NA, NA, 111L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 70L,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 71L,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, 249L, NA, NA, NA, NA, 1249L, 636L, 710L, NA, NA, 27L, NA,
50L, NA, NA, NA, NA, NA, 531L, NA, NA, NA, NA, NA, NA, 63L, NA,
NA, NA, 416L, NA, NA, 400L, 902L, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, 116L, NA, NA, NA, 674L, NA, NA, NA, NA, NA, NA,
1439L, 305L, NA, NA, NA, NA, NA, 93L, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, 2L, NA, 1107L, NA, 13L, NA, 201L,
NA, 470L, NA, 184L, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, 72L, NA, NA, NA, 2727L, 33L, NA, 121L, 643L,
NA, NA, 168L, NA, 160L, NA, NA, NA, NA, NA, NA, NA, NA, 1732L,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 666L,
60L, NA, 128L, NA, NA, 140L, NA, NA, NA, NA, 15L, NA, NA, NA,
NA, 1726L, NA, NA, NA, NA, NA, 1966L, NA, NA, NA, 77L, 76L, NA,
199L, NA, NA, 54L, NA, 377L, NA, NA, NA, NA, NA, NA, NA, NA,
738L, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1422L, NA, NA,
NA, NA, NA, NA, 695L, NA, NA, NA, NA, NA, 15L, NA, 1058L, NA,
NA, 680L, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 534L, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, 850L, NA, NA, NA, NA, NA, 11L, NA, NA,
NA, NA, NA, NA, NA, NA, NA, 51L, NA, NA, NA, NA, NA, NA, 146L,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA)), .Names = c("ColonyMass_At_Wrkr_Eclosion", "ColonyMass_4wksLater",
"ColonyMass_2mnthsLater"), class = "data.frame", row.names = c(NA,
-622L))
just_growth_data_factor<-factor(c("ColonyMass_At_Wrkr_Eclosion", "ColonyMass_4wksLater", "ColonyMass_2mnthsLater"))
x<-rep(just_growth_data_factor,622)
qplot(just_growth_data_factor, x)
答案 0 :(得分:2)
# add an id column (presumably rows are individuals)
just_growth_data$id <- 1:nrow(just_growth_data)
# melt the data, collapsing the three categorical columns down into two:
# variable (the column name) and value (the column value)
require(reshape)
data.m <- melt(just_growth_data, id.vars="id")
# a simple scatterplot with the original rows connected
ggplot(data.m, aes(x=variable, y=value, group=id)) +
geom_line() +
geom_point()