1
我有data.frame名爲PP,看起來像這樣:使用結果指數data.frame
> head(pp)
X02R X03N X04K X04N X04R X06I X06N X08J X08P X09O X11O
1961-02-28 42.0 43.0 96.2 10.2 13.5 42.4 21.1 79.1 2.7 15.2 14.3
1962-02-28 17.1 22.7 27.9 140.7 10.0 36.7 8.2 47.2 28.5 31.5 24.0
另外我計算
dmax<-douro[which(douro[,3]== max(douro[,3])),]
其中,例如給我:
> dmax
name catch corre.gauge
31 X04K Douro -0.5157648
現在我想使用的結果dmax[1]
(名稱)繪製從數據頁的各個欄。在這種情況下我也喜歡繪製pp$X04K
。我怎樣才能以自動的方式做到這一點(因爲我將多次重複這個過程,導致pp不同的列)?
感謝您的回答我嘗試過,但我總是得到一個錯誤:'> pp [,dmax [1]]' '.subset(x,j)中的錯誤:無效下標類型'list'' pp [dmax [1]]' '[.default'(pp,dmax [1])中的錯誤:無效的下標類型'list'' – sbg
嘗試'pp [,dmax [1,1]]''。 – joran
這很奇怪,使用'pp [,dmax [1,1]]'我沒有收到錯誤,但是它提取了錯誤的列。然而,如果我做了'dmax [1,1]''我得到了正確的名字......還有'class(dmax [1,1])' '[1]「factor」' – sbg