I would like to make two different histograms with a distribution curve in the same window with "data1" and "data2" from a txt file. I can create a histogram with data from columns of "data1" and "data2" combined but not seperated. How can I seperate my data? Thanks.
data1 data2
155 130
195 10
21 26
15 210
190 15
2 205
182 50
115 55
170 1
17 56
Data = as.matrix( read.table( "c:\\Data.txt",header=TRUE ) )
attach( Data )
par( mfrow=c(1,2) ) #c(rows,columns)
hist(Data ,plot=TRUE, col=c("red","blue"),
main = "Histogram of Data1",
xlab="X-Axis", ylab="Y-Axis", cex.lab= 1, col.lab="blue" )
#Curve is not working even if data is combined
curve(dnorm(x, mean=mean(Data), sd=sd(Data)), add=TRUE, col="blue", lwd=2)

