Re: [R] Plotting Frequency Distribution in R

From: Sachin J <sachinj.2006_at_yahoo.com>
Date: Wed, 14 May 2008 11:18:02 -0700 (PDT)


Thank you everyone for your help. I tried the following. Please let me know if I can use this method. df1$V2<-as.numeric(gsub("[%]","", df1[,2])) xbin <- binning(df1$V2,df1$V1,nbins=12)
barplot(xbin$sums,xbin$x,xlab="V2",border = TRUE,ylab="V1",col="red") Thanks,
Sachin

Hi Sachin,

Is this what you want?

df<-"V1      V2

1   1 160.54%
2   1 201.59%
3   1  18.45%
4   1 179.03%
5   1 274.37%
6   1   0.00%
7   1  24.52%
8   1  39.17%
9   3  43.72%
10  1  53.06%
11  1  64.97%
12  1  79.84%
13  1  98.08%
14  1 115.32%
15  1 127.96%
16  1 155.38%
17  1 157.25%
18  1 193.17%
19  1  51.53%
20 15  99.32%

21  1 106.86%
22  1 219.44%"

mydf<-read.table(textConnection(df),header=TRUE) mydf$V2<-as.numeric(gsub("[%]","", mydf[,2]))

x<-rep(mydf$V2,mydf$V1)

# Plots
par(mfrow=c(2,2))

hist(x,prob=TRUE)
plot(density(x),type='l',col=2)
plot(ecdf(x))
plot(x,xlab="Observation")

HTH, Jorge

On Tue, May 13, 2008 at 10:25 AM, Sachin J <sachinj.2006_at_yahoo.com> wrote:

Hi,
How can plot a frequency distribution curve for the following data.

   V1      V2
1   1 160.54%
2   1 201.59%
3   1  18.45%
4   1 179.03%
5   1 274.37%
6   1   0.00%
7   1  24.52%
8   1  39.17%
9   3  43.72%
10  1  53.06%
11  1  64.97%
12  1  79.84%
13  1  98.08%
14  1 115.32%
15  1 127.96%
16  1 155.38%
17  1 157.25%
18  1 193.17%
19  1  51.53%
20 15  99.32%

21  1 106.86%
22  1 219.44%

Where V1 is count for each V2 value. for example there are 3 entries for 43.72% value. Thanks in advance for the help.
Regards,
Sachin

       [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
      
	[[alternative HTML version deleted]]



______________________________________________

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 14 May 2008 - 20:44:33 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 14 May 2008 - 21:30:44 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive