2014-03-31 26 views
0

我已經做了使用嘎嘎聚類並在結束我有數據的格式如下: enter image description here如何在同一圖中繪製每個羣集的箱形圖?

我需要繪製箱線圖的相同的圖中的每個集羣。 (即有5個簇),所以在X軸上,我需要1到5個簇號,而在Y軸上我需要年齡。)

我做了以下事情。但我無法達到我的預期。 enter image description here enter image description here enter image description here

任何人都可以提出正確的設置,以獲得5箱線圖中每個羣集並行?

+1

我不知道拉特爾,但在控制檯中,您可以使用一個公式如下:'foo < - data.frame(Age = rnorm(100),Cluster = sample(LETTERS [1:5],100,replace = TRUE))',那麼boxplot:'boxplot(Age〜Cluster ,foo)' –

+0

謝謝@Stephan Kolassa – Nadaraj

+0

我找到了原因。羣集變量的格式應該是「Category」 – Nadaraj

回答

0

在你可以做到。首先在框架中讀取文件。 評論< - read.csv( 「abc.csv」,stringsAsFactors = FALSE)

箱線圖(評論$歲〜評論$ Cluster)的

相關問題