I would like to calculate the percentage frequency distribution of h1 and h2. How can I combine h1 and h2 on the same plot? The length of the vectors are different in h1 and h2. I tried the following code. it gives the plot for h1 only. your suggestions would be appreciated!!
h1=c(5.18,4.61,3.30,7.58,3.00,3.80,1.95,2.67,2.77,2.73,2.33,3.36,3.50,1.91,4.25,3.87,2.86,2.26,2.00,3.86,3.33,3.59,4.00)
'Proteins'
h2=c(2.1,2.1,2.6,2,3.6,2,2.7,1.8,3.1,3.9,3.8,2.6,1.9,2.6,2.1,3.9,2.7,1.8,2.1,2.3,2.2,2.6,1.8,2.3,2.3,3.7,3.3,1.9,2.4,2.6,2.4,3.4,2.4,2.2,1.8,2.1,2,1.2,3.9,1.9,3.4,2,2.2,2.3,2.6,2,3,1.8,1.6,1.5,2.6,3.2,2.3)
h = hist(h1)
h$percentage = h$counts/sum(h$counts)*100
plot(h, freq=F, xlab=, ylab='Percentage')
Mostafa Thank you for your answer.Where do I have to add
par(new=TRUE)
@ayyappadas342 between the plots , it says hold on so that you can plot another plot on an existed one! for example
plot(x,y); par(new=TRUE); plot(x,y)
in case you are calling someone , it is better you call it with a correct name so that s/he will see your comment. You should have written @Mo and not Mostafa . that is why I did not see your comment