[R] Plotting Frequency Distribution in R
tony.sun
wxs1949 at gmail.com
Wed May 14 08:26:05 CEST 2008
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))
#make some changes#
d<-rep(x$V2,times=x$V1)
hist(d)
jholtman wrote:
>
> 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 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<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]]
>
> ______________________________________________
> 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.
>
>
--
View this message in context: http://www.nabble.com/Plotting-Frequency-Distribution-in-R-tp17210180p17224194.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list