2014-03-03 82 views
1

沒有繪製我有這樣的數據集:訂單數據中的R

Store; 

    founder wt.Df Replicate Block Food_Source Viability 
1  A4 5905   1  1  Regular 0.9523810 
2  A4 24834   1  1  Regular 0.8095238 
3  A4 24834   2  1  Regular 0.8571429 
4  A4 27861   1  1  Regular 0.8095238 
5  A4 27861   2  1  Regular 0.9230769 
12  A3 5905   1  1  Regular 0.9473684 
13  A3 24834   1  1  Regular 0.9047619 
14  A3 27861   1  1  Regular 0.8571429 

attach(Store); 
plot(wt.Df, Viability); 

我的輸出:enter image description here

我想與A3下令對通過商店$創始人Y軸左邊,A4在右邊。我最終希望通過一條線連接Store $ wt.Df中的所有值。我的輸出應該是左邊的A3和右邊的A4。例如5905應該有一條連接它們的線。

+0

乍得什麼,我也不完全清楚你的意思。我認爲,如果您能提供某種圖表或圖片說明您的期望輸出是什麼,那可能會更清楚。我知道你在上面解釋過,但我沒有遵循。 – JPC

+0

我不知道引用的東西,但這是我想要的,但與我的數據:http://openi.nlm.nih.gov/detailedresult.php?img=2936530_pgen.1001100.g004&req=4 – Chad

回答

2

是這樣的你在想的

library(ggplot2) 
dat<-data.frame(obs=rep(c(1,2),each=2), type=rep(c("a","b"),2),y=c(1,2,3,4)) 
qplot(x=type, y=y, group=obs, data=dat, geom="line")+geom_point() 

enter image description here

+0

你擊中了靶心 – Chad

+0

你將如何用5905和27861的數據做這個上面的例子? – Chad

+0

使用子集命令: qplot(x = type,y = y,group = obs,data = subset(dat,type%in%c(「a」,「b」)),geom =「line」) + geom_point() 您可以相應地更改您的數據 – JPC