求帮助
在单因素多层次的时候要提取其中一个层次中的一个部分来做直方图和正态密度曲线怎么code啊
就是成本是response; 国家 是experimental factor,其中1代表加拿大,1代表美国
我要怎构建加拿大成本的直方图啊 求助 磕头了
可用如下示例代码,从中取出数据框作图。
getwd()
library(ggplot2)
#rm(list=ls())
cost=c(11.7,16.5,14.13,15.21,14.11,9.05,9.58,10.8,15.63,5.67,11.68,11.28,12.42,9.87)
period<-as.factor(rep(1:7,times=2))
country<-as.factor(rep(1:2,each=7))
qdata<-data.frame(country,period,cost)
d<-qdata[qdata$country==2,]
g<-ggplot(d, aes(x=cost)) +
geom_histogram(color='black',fill='blue',binwidth=1)
plot(g)