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]]
Does something like this do it for you:
x <- read.table(textConnection(" 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%"), header=TRUE, as.is=TRUE)
# change to numeric
x$V2 <- as.numeric(gsub("%", "", x$V2))
plot(x$V2, x$V1, type='h', lwd=2)
On Tue, May 13, 2008 at 10:25 AM, Sachin J <sachinj.2006@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@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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem you are trying to solve?
[[alternative HTML version deleted]]
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
----- Original Message ----
From: Jorge Ivan Velez <jorgeivanvelez@gmail.com>
To: Sachin J <sachinj.2006@yahoo.com>
Sent: Tuesday, May 13, 2008 11:33:56 AM
Subject: Re: [R] Plotting Frequency Distribution in R
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@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@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]]