作者Johnpolo (隱行)
站內Statistics
標題Re: [問題] 請問R語言
時間Thu Nov 25 15:27:03 2010
※ 引述《Johnpolo (隱行)》之銘言:
: 請問R語言的hist的語法
: 假如要畫頻率圖
: 那個hist(x,brokes,.....)
: x是不是一定要數值
: 可是我現在有一筆excel的資料
: 要如何套用劃出hist的頻率圖
幫我看到底錯在哪裡?
> x<- read.csv("C:/test/Mid_Ex.csv", header=FALSE,
col.names=c("Year","Month","SST"))
> hist (x ,breaks=12,freq=TRUE,col= 3,labels=TRUE)
錯誤在hist.default(x, breaks = 12, freq = TRUE, col = 3, labels = TRUE) :
'x' must be numeric
--
※ 發信站: 批踢踢實業坊(ptt.cc)
推 Aqery:你這樣x是dataframe,不是numeric vector 11/25 15:44
→ Aqery:class(x)看看結果是什麼吧 11/25 15:45
→ Aqery:如果你要畫hist的是SST的話,你在hist的地方試試看x$SST 11/25 15:46
→ Johnpolo:樓上他顯是這樣的圖鑑:錯誤在x$SST : $ operator is inv 11/25 16:24
→ andrew43:有 header 的話, header=T 才對喔. 原po有寄csv給我. 11/25 16:30
※ 編輯: Johnpolo 來自: 114.32.49.184 (06/16 14:57)