我正在使用如下数据集:
1 48434 14566
1 56711 6289
1 58826 4174
2 56626 6374
2 58888 4112
2 59549 3451
2 60020 2980
2 60468 2532
3 56586 6414
3 58691 4309
3 59360 3640
3 59941 3059
.
.
.
10 56757 6243
10 58895 4105
10 59565 3435
10 60120 2880
10 60634 2366
我需要在第三列的 R 中为第一列的每个值绘制一个图,即对于上述数据,将有 10 个不同的第三列值图(每组 1-10)。 x 轴是迭代次数,Y 轴是最大 63000 的值。我还需要用红色线连接这些点。
我是 R 新手,一直在阅读文档,但这让我更加困惑。请任何人帮忙。
EDIT: I actually want line graph of V3 values. the number of rows of v3 column would be on x-axis and v3 values on y-axis. And I want different graphs each for a group indicated by v1. Chase's solution works except that I want the axis shifted, the V3 values should be on y-axis.here is example
编辑2:@Roman,这是我正在执行的代码。
library(lattice)
d <- read.delim("c:\\proj58\\positions23.txt",sep="")
d <- do.call(rbind, lapply(split(d, d$V1), function(x) {
x$iterations <- order(x$V3, decreasing=TRUE)
x
}))
xyplot(V3 ~ iterations | V1, type="l", data=d)
这是我得到的错误,
>
> source("C:\\proj58\\plots2.R")
> d
V1 V2 V3 iterations
1.1 1 48434 14566 1
1.2 1 56711 6289 2
1.3 1 58826 4174 3
1.4 1 59528 3472 4
我没有得到任何情节?我错过了什么好的,我知道了。不知道出了什么问题。这里是,
还有 2 件事,如何将盒子上的 V1 标签更改为实际数字,例如 1,2,...
其次,我有包含 100 个组的文件,我尝试了一个,它使所有图表都在一页上(显然不可读),我可以在多个窗口上制作这些图表吗?