From: Jorge Ivan Velez <jorgeivanvelez_at_gmail.com>

Date: Sun, 27 Apr 2008 14:04:51 -0400

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 Sun 27 Apr 2008 - 18:10:43 GMT

Date: Sun, 27 Apr 2008 14:04:51 -0400

Dear Marcelha,

Is this what you want?

x="

Values 1 2 3 4 5 Frequency 10 34 56 67 98 Factor 105 50 60 150 200"

# Data set

m=read.table(textConnection(x),header=FALSE)

# Weights

w=as.numeric(m[m$V1=="Frequency",2:6]/m[m$V1=="Factor",2:6])

# Plot

plot(1:5,as.numeric(w),type='h',xlab='Value',ylab='Frequency/Factor',col=1:5,main='Your
plot')

# The same using barplot

barplot(as.numeric(w),1:5,space=.1,width=.8,col=1:5,xlab='Value',ylab='Frequency/Factor',main='Your
plot')

**HTH,
**
Jorge

On Sun, Apr 27, 2008 at 12:41 PM, marcelha mukim <urianha_at_gmail.com> wrote:

> Hi Sarah:

*>
**> Thank you very much, but my problem remains. What I want is not duplicate
**> the sample, but be able to divide each frequency for a factor(specific for
**> each value).For example:
**>
**> Values 1 2 3 4 5
**> Frequency 10 34 56 67 98
**> Factor 105 50 60 150 200
**>
**> Actually Im plotting: plot(Values, Frequency/Factor, type="b"). But I dont
**> know how to visualize the probability distribution. On the hand to modify
**> the "hist" function to include this Factor seems to be a daunting task.
**>
**> any other advise will be welcome
**>
**> thank you
**>
**> m.
**>
**>
**>
**> On Sun, Apr 27, 2008 at 9:11 AM, Sarah Hardy <sarah.hardy_at_maine.edu>
**> wrote:
**>
**> > This is a reply to:
**> >
**> > Message: 43
**> >
**> > Date: Sun, 27 Apr 2008 02:41:36 -0400
**> >
**> > From: "marcelha mukim" <urianha_at_gmail.com>
**> >
**> > Subject: [R] how to modify the histogram's frequencies
**> >
**> > To: r-help_at_r-project.org
**> >
**> > Message-ID:
**> >
**> > <80f5a0c30804262341x3f04d141g65f4fc2d576672f9@mail.gmail.com>
**> >
**> > Content-Type: text/plain
**> >
**> >
**> >
**> > Hi:
**> >
**> >
**> >
**> >
**> >
**> > I have been trying to figure out a simple way to plot an histogram whose
**> >
**> > frequencies are modified by a factor (associated with each value).
**> >
**> >
**> >
**> >
**> >
**> > Actually what I did was plotting each value with its modified
**> >
**> > frequency(using plot($values, $frequency, type="h")), but it doesnt take
**> >
**> > into account the probability distribution(which is necessary).
**> >
**> >
**> >
**> > I think you should be able to:
**> >
**> >
**> >
**> > newvalue=rep($value,$frequency)
**> >
**> > hist(new,value,freq=F)
**> >
**> >
**> >
**> > Sarah Hardy
**> >
**> > sarah.hardy_at_maine.edu
**> >
**> >
**> > [[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.
**>
*

[[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 Sun 27 Apr 2008 - 18:10:43 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 Sun 27 Apr 2008 - 19:30:32 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.
*