0
在R編程中,我想繪製一個來自數據集的多列的圖。爲多個列繪製一個圖
例如 這是我的示例代碼 這裏我添加了更多數據集,我想將所有值合併到一個圖中。我怎麼能把這個結合起來?
stock_apple<-read.csv(file="apple.csv",header = TRUE,sep=",")
stock_microsoft<-read.csv(file="microsoft.csv",header=TRUE,sep=",")
stock_google<-read.csv(file="google.csv",header = TRUE,sep=",")
stock_twitter<-read.csv(file="twitter.csv",header = TRUE,sep=",")
var1<-stock_apple$high
var2<-stock_google$high
var3<-stock_microsoft$high
var4<-stock_twitter$high
install.packages("ggplot2")
library(ggplot2)
#this is for only one column but i want a plot for more than one column
qplot(var1,
geom="histogram",
binwidth = 0.5,
main = "Histogram for Apple stock_price",
xlab = "stock price",
fill=I("blue"),
col=I("red"),
alpha=I(.2),
xlim=c(100,3000))
請郵寄:'頭(VAR1)'和'頭(VAR2)' – PoGibas