2
我有一個列表命名爲d
這樣的只有一個子集:使用qplot繪製數據
V1
是一個整數設定從0 - 50 V2
是從1500年真正的集 - 1800 V3
是一個整數集從1 - 50
在總,該列表包含5100個對象
現在我想繪製的V2
直方圖,具有V1
=一定數量(0,1或10等)
我嘗試不同的方法:
factor(d$V1)
qplot(V2, data=d, V1 = 1) --> not successful
d.subset <- subset(d, d$V1 = 1) --> not successful
我真的很瘋狂與此有關。檢查d$V1
的特點,但發現沒有什麼奇怪的。任何人都可以幫助我?
is.factor(d$V1)
[1] TRUE
str(d$V1) Factor w/ 51 levels "1","2","3","4",..: 1 2 3 4 5 6 7 8 9 10 ...
levels(d$V1)
[1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19"
[20] "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31" "32" "33" "34" "35" "36" "37""38"
[39] "39" "40" "41" "42" "43" "44" "45" "46" "47" "48" "49" "50" "51"
是'd'列表還是數據框? (當你嘗試'dput(head(d))'時,你會得到什麼'' –
如果你不再使用'qplot','ggplot()+ geom_xxxx',那麼http://stackoverflow.com/questions/14431246/忽略ggplot-in-r中的一個因素/ 14437598#14437598將會很有用 – mnel