Snippets

Firoj Alam How to Histogram with relative frequency in R

Created by Firoj Alam
1
2
3
4
5
6
7
8
How to Histogram with relative frequency in R?
data = read.table(infilename, sep="\t", fill=FALSE, strip.white=TRUE, head=T)
here data$V2 is your data
> h<-hist(data$V2, plot=F)
> h$counts <- h$counts / sum(h$counts)
> plot(h, freq=TRUE, ylab="Relative Frequency")
> plot(h, freq=TRUE, ylab="Relative Frequency",ylim=c(0.0,1.0),xlim=c(0.0,1.0))

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.