我想爲CSV文件中的每一行創建圖表。目前,我的做法是相當手冊:爲CSV數據的每一行在R中創建圖表
require(fmsb)
range <- c(0, 2)
# information about eID1
eID1 <- c(attribute1[1], attribute2[1], attribute3[1],
attribute4[1], attribute5[1])
eID1.df <- data.frame(rbind(max=range[2], min=range[1], eID1))
# create a radar chart for eID1
radarchart(eID1.df, axistype=1, pcol=topo.colors(3, 0.5), plty=1, pdensity=10, pfcol=topo.colors(3, 0.5), seg=2, caxislabels=c("Negative", "Neutral", "Positive"),
vlabels=c("Category 1", "Category 2", "Category 3", "Category 4", "Category 5"),
title = "About Employee ID 1")
# information about eID2
eID2 <- c(attribute1[2], attribute2[2], attribute3[2],
attribute4[2], attribute5[2])
eID2.df <- data.frame(rbind(max=range[2], min=range[1], eID2))
# create a radar chart for eID2
radarchart(eID2.df, axistype=1, pcol=topo.colors(3, 0.5), plty=1, pdensity=10, pfcol=topo.colors(3, 0.5), seg=2, caxislabels=c("Negative", "Neutral", "Positive"),
vlabels=c("Category 1", "Category 2", "Category 3", "Category 4", "Category 5"),
title = "About Employee ID 2")
我的問題是:是否有可能通過數據迭代的CSV文件,並創建爲每個行數據的圖表?原始數據的
結構:(以CSV文件)
(eID) Attribute1, Attribute2, Attribute3, Attribute4, Attribute5
(1) 1, 2, 1.75, 1.75, 1
(2) 1, 2, 2, 2, 2
(3) 2, 2, 2, 1.5, 1.5
(4) 1, 1, 1, 1, 0
(5) 1, 2, 1, 0, 1
是的,它是可能的。如果沒有訪問你的數據,很難說明如何。 – alexwhan
我已經包含了一個數據樣本。正如你所看到的,我在CSV文件中有一個標題行,然後是這些標題下的相應屬性數據。 – Outrigger