使用R中的纵向数据绘制三维曲面
我有以下格式的数据:使用R中的纵向数据绘制三维曲面,r,plot,3d,ggplot2,R,Plot,3d,Ggplot2,我有以下格式的数据: Time Endpoint.Value PlasmaConc Group AnimalID 0 120 .8 1 1 2 140 .4 1 1 4 115 .2 1 1 8 108 .1 1 1 24 100 .0
Time Endpoint.Value PlasmaConc Group AnimalID
0 120 .8 1 1
2 140 .4 1 1
4 115 .2 1 1
8 108 .1 1 1
24 100 .0 1 1
0 115 .9 1 2
2 130 .7 1 2
4 112 .4 1 2
8 110 .3 1 2
24 107 .1 1 2
...
0 112 .6 1 12
2 104 .5 1 12
4 98 .2 1 12
8 78 .15 1 12
24 58 .08 1 12
endpointPlot <- ggplot(data = allData, aes(x = Time, y = Endpoint.Value, group = Group, color = Group)) + geom_point()+
stat_summary(geom = "point", fun.y = mean, shape = 17, size = 7)+
stat_smooth(aes(fill = Group))+
ggtitle("Endpoint (Glucose) vs Time with smoothed standard errors by Group")
concentrationPlot <- ggplot(data = allData, aes(x = Time, y = PlasmaConc, group = Group, color = Group)) + geom_point()+
stat_summary(geom = "point", fun.y = mean, shape = 17, size = 7)+
stat_smooth(aes(fill = Group))+
ggtitle("Plasma Concentration vs Time with smoothed standard errors by Group")
可能地这会返回什么数据,表时间,PlasmaConc?将该信息作为编辑添加到您的问题中,您可以保留格式。@BondedDust:我已经发布了请求的信息。目的是查看内部单元格中有多少部分有数据,以及是否有任何区域有足够的数据点来支持正在构建的曲面。两种选择:在合理选择的分组区间内进行聚合和插值或克里格法。您可能希望在SO上搜索akima或其他支持插值的函数。我个人拒绝玩那些有。。。。。。数据显示中的行。工作示例:
PlasmaConc
Time 0 0.0381 0.0453 0.0708 0.0754 0.0846 0.129 0.15 0.311 0.313 0.368 0.4 0.427 0.446 0.535 0.657 0.674 0.678 0.719 0.87 0.882 0.934 1.01 1.02 1.03 1.09 1.12 1.15 1.16 1.17 1.19
0 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0
2 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
4 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 1 1 0 0
8 6 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 0 0 0 1 0 0 0 1 0 0 1 0 0 0 1