On 8/31/07, squall44 [EMAIL PROTECTED] wrote:
Hello,
Although I've done lots of research on histograms, I'm still not able to
create one. I'd be glad if someone could explain them to me.
That's what it eventually should look like:
http://www.nabble.com/file/p12423193/histogram.gif
The
livia wrote:
Hello, I would like to plot a histogram with title Return, and I would like
the font for the title to be Bold and the size to be 8( as in Excel).
I tried the following code, but it does not make any change. Could anyone
give me some advice?
See ?par.
Uwe Ligges
hist
squall44 wrote:
Hello,
I wanted to create a histogram, but somehow I got stuck...
The interval limits are: x = 1, 2, 3, 3.5, 4.5, 5, 5.5
The interval widths are therefore: 1, 1, 0.5, 1, 0.5, 0.5
Please read the help page more carefully! See ?hist and its argument
breaks.
Uwe Ligges
Well, that was the first thing I tried. But the help only gives you the
commands and does not explain how to use it (I am a newbe). How do I use the
argument 'breaks'?
I tried:
#---
x = c(1, 2, 3, 3.5, 4.5, 5, 5.5)
breaks=c(1, 1, 0.5, 1, 0.5, 0.5)
hist(x,
breaks= breaks,
xlim=c(0,7),
squall44 wrote:
Well, that was the first thing I tried. But the help only gives you the
commands and does not explain how to use it (I am a newbe). How do I use the
argument 'breaks'?
I tried:
#---
x = c(1, 2, 3, 3.5, 4.5, 5, 5.5)
breaks=c(1, 1, 0.5, 1, 0.5, 0.5)
hist(x,
breaks=
In the absence of a data set, it may help to read the help file carefully:
?hist
Note, in particular, that the argument freq defaults to TRUE if and only if
breaks are equidistant (and probability is not specified).
Regards,
Mark.
Sarah Goslee wrote:
Well, how about an example of what you
Meanwhile I have recognized, that the breaks-option enforces density as
the default. But if I try to force frequencies (freq=TRUE) I get the
following feedback:
Warning message:
the AREAS in the plot are wrong -- rather use freq=FALSE in:
plot.histogram(r, freq = freq, col = col, border = border,
Well, how about an example of what you are doing, and a
description of what the results you get and the results you
want are?
When I do a histogram, I get frequencies.
Sarah
On 7/9/07, Mag. Ferri Leberl [EMAIL PROTECTED] wrote:
Meanwhile I have recognized, that the breaks-option enforces
The default of hist() is counts rather than percentages.
Sarah
On 7/6/07, Mag. Ferri Leberl [EMAIL PROTECTED] wrote:
Dear everybody!
Is ist easily possible to make up a histogram with absolute numbers
instead of percentages?
Thank you in advance!
Yours, Mag. Ferri Leberl
I expect there's a more elegant way of doing this, but this should work:
set.seed(101)
x - rnorm(500,sd=.03)
hist (x, seq(-0.1,0.1,0.01),freq = FALSE)
d - density(x,bw=SJ)
lowt - d$x -.05
upt - d$x .05
lines (d$x[lowt],d$y[lowt], col = red)
lines(d$x[upt],d$y[upt], col = red)
On 19/06/07,
Your subsetting expression in lines does not make any
sense at all.
Not tested but maybe something like:
lines (density(subset(x, x 0.05 x -0.05)bw=SJ),
col='red)
--- livia [EMAIL PROTECTED] wrote:
Hello, I am using the following codes to plot a
histogram and density line
for x. For the
On Mon, 2007-06-18 at 19:40 -0400, suman Duvvuru wrote:
Hello,
I wanted to know how to plot a histogram using a vector of frequencies
rather than the data vector as a whole. So I have two vectors: a vector of
labels V1= c(A,B,C,D) and vector B which is a vector of frequencies
of A, B, C
will this work for you?
x - runif(1000, 0, 40)
x.c - cut(x, breaks=c(0, 1, 3, 6, 10, Inf))
barplot(table(x.c))
On 4/19/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Hi R-helpers
I would like to produce a histogram with uneven bins (e.g., 0, 1-2, 3-5,
6-10, 10-20, 20) but I would like the
If I correctly understand,
hist(rep(1, 100), col=lightblue, border=black,breaks=0:10*0.1)
see:
breaks arg in ?hist
On 2/7/07, Dong H. Oh [EMAIL PROTECTED] wrote:
Dear expeRts,
I'd like to picture histogram of ones.
For example,
hist(rep(1, 100), col=lightblue, border=black)
A bin is
There are several ways to do this, probably the easiest is to use
truehist from MASS. i.e
require(MASS)
par(mfrow=c(3,1)) #3 rows of histograms, one column
truehist(x,h=.05)
truehist(y,h=.05)
truehist(z,h=.05)
I hope this helps,
Francisco
--
Dr. Francisco J. Zagmutt
College of Veterinary
Hi,
There may be an easier way but here is one way you can do it.
# create vector that has Y[i] X[i]s
new.data - rep(X,Y)
hist(new.data, breaks=c(0,.1,.4,.6)) # or something like that look at
what exactly breaks should be.
Ritwik.
On 9/27/06, Mohsen Jafarikia [EMAIL PROTECTED] wrote:
Dear
On Wed, 2006-09-27 at 18:29 -0400, Mohsen Jafarikia wrote:
Dear all,
I want to design a histogram and I need to have the frequency at certain
points. For example I have the following 2 columns:
*X Y*
0.125
0.422
0.45 11
0.55 21
I want the chart to have 4 columns.
Try this:
library(lattice)
set.seed(1) ## added for reproducibility
Start - factor(rbinom(100,1,.5))
Answer - 2 - rbinom(100,1,.7)
histogram(~Answer | Start,
breaks=c(1, 1.4 ,1.6,2),
scales=list(x=list(at=c(1.2,1.8),labels=c(Yes,No))),
panel = function(x, ...,
I think this should do it:
lenh - hist(iris$Sepal.Length, br=seq(4, 8, 0.05))$counts
lenh # original data
[1] 0 0 0 0 0 1 0 3 0 1 0 4 0 2 0 5 0 6 0 10 0 9
0 4 0 1 0 6 0 7 0 6 0
[34] 8 0 7 0 3 0 6 0 6 0 4 0 9 0 7 0 5 0 2 0 8 0
3 0 4 0
On Sun, 17 Sep 2006 15:12:30 -0500,
Sebastian P. Luque [EMAIL PROTECTED] wrote:
[...]
I thought about some very contrived ways to accomplish this, involving
'which' and 'diff', but I sense a function might already be available to
do this efficiently.
I think I found a better combination of
On Sun, 17 Sep 2006 18:05:15 -0400,
jim holtman [EMAIL PROTECTED] wrote:
I think this should do it:
[...]
Thank you Jim, the idea with 'rle' is great. I missed your follow-up
before mine a minute ago with another solution. I'll do some testing with
both.
Cheers,
--
Seb
Alexandre Depire wrote:
Hello,
I have the following data:
Km Sex
250 1
300 2
290 2
600 1
450 2
650 1
.
I would like to obtain one histogram where the data (or the part) of each
sex is visible, it is like cumulative histogram or spinogram.
To be more comprehensible, i would
On Fri, 15 Sep 2006 16:45:31 +0200 Alexandre Depire wrote:
Hello,
I have the following data:
Km Sex
250 1
300 2
290 2
600 1
450 2
650 1
.
I would like to obtain one histogram where the data (or the part) of
each sex is visible, it is like cumulative histogram or spinogram.
How about this?
http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=78
JeeBee
On Wed, 06 Sep 2006 18:19:28 +0800, gallon li wrote:
I intend to draw a plot of y against x. In the background of this graph I
wish to creat a histogram of the horizontal variable x. Does any expert
gallon li wrote:
I have found this one before. However, my intension is slightly differing
from this plot: I wish to plot the histogram in the backgroun instead of
in the margin. Thanks anyway!
On Wed, 06 Sep 2006 12:29:51 +0200, JeeBee wrote:
How about this?
--- JeeBee [EMAIL PROTECTED] wrote:
gallon li wrote:
I have found this one before. However, my intension
is slightly differing
from this plot: I wish to plot the histogram in the
backgroun instead of
in the margin. Thanks anyway!
On Wed, 06 Sep 2006 12:29:51 +0200, JeeBee wrote:
I intend to draw a plot of y against x. In the background of this graph I
wish to creat a histogram of the horizontal variable x. Does any expert know
how to produce such a plot?
When constructing such a plot, you need to be careful that you don't
end up constructing a pretty picture instead
try something along these lines:
input - rpois(1000, 5)
myhist - hist(input, breaks = 15, plot = FALSE)
plot(myhist, labels = as.character(myhist$breaks[-1]), axes = FALSE)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
On Mon, 2006-05-08 at 14:22 +0200, Dimitris Rizopoulos wrote:
try something along these lines:
input - rpois(1000, 5)
myhist - hist(input, breaks = 15, plot = FALSE)
plot(myhist, labels = as.character(myhist$breaks[-1]), axes = FALSE)
it seems to give me the labels slided by one, but it
Le 21.04.2006 10:48, Johan van Niekerk a écrit :
Dear All,
I am trying to create a histogram-like plot for comparing two datasets -
For each interval, I want it to draw 2 bars - one for representing the
number of values in each dataset for that interval.
I have looked at the help for the
jia ding wrote:
Then, I use command:
score- read.csv('file.csv', header = FALSE,sep = ,)
hist(score, main = score)
it gives error msg:
Error in hist.default(score, main = score) :
'x' must be numeric
Can any of you know about it explain me why?
Have a look at 'score' in R
Sean == Sean Davis [EMAIL PROTECTED] writes:
Sean Have you tried just grabbing the whole column using dbGetQuery?
Sean Try doing this:
Sean
Sean spams - dbGetQuery(con,select unixtime from email limit
Sean 100)
Sean
Sean Then increase
Eric Eide wrote:
Sean == Sean Davis [EMAIL PROTECTED] writes:
Sean Have you tried just grabbing the whole column using dbGetQuery?
Sean Try doing this:
Sean
Sean spams - dbGetQuery(con,select unixtime from email limit
Sean 100)
Sean
Sean
[R] Histogram over a Large Data Set (DB): How?
Have you tried just grabbing the whole column using dbGetQuery? Try doing
this:
spams - dbGetQuery(con,select unixtime from email limit 100)
Then increase from 1,000,000 to 1.5 million, to 2 million, etc. until you
break something (run out
On Wed, 16 Nov 2005, Christopher Willmot wrote:
The hist() command produces this message on my machine...
Error in title(main = main, sub = sub, xlab = xlab, ylab = ylab, ...) :
X11 font at size 14 could not be loaded
How can I either (a) determine what font is required,
or
On Wed, 16 Nov 2005, Christopher Willmot wrote:
The hist() command produces this message on my machine...
Error in title(main = main, sub = sub, xlab = xlab, ylab = ylab, ...) :
X11 font at size 14 could not be loaded
How can I either (a) determine what font is required,
or (b)
Florian Defregger wrote:
Dear all,
I wonder if I can put together a histogram where one bin contains all the
values that are larger than a certain specified value.
Example:
I have values ranging from 0 to 40 and I want 10 bins from 0 to 10, i.e. for
the intervals [0,1), [1,2) , ...,
Le 26.09.2005 16:15, Sundar Dorai-Raj a écrit :
Florian Defregger wrote:
Dear all,
I wonder if I can put together a histogram where one bin contains all the
values that are larger than a certain specified value.
Example:
I have values ranging from 0 to 40 and I want 10 bins from 0 to 10,
x=runif(100,0,40)
hist(x, breaks=c(0,1,2,3,4,5,6,7,8,9,10,40))
Is this what you had in mind?
Francisco
From: Florian Defregger [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Subject: [R] histogram - one bin for all values larger than a certain value
Date: Mon, 26 Sep 2005 15:36:21 +0200
Dear
Deepayan Sarkar wrote:
On 8/24/05, ernesto [EMAIL PROTECTED] wrote:
Hi,
I'm trying to develop an histogram method for a class called FLQuant
which is used by the package FLCore (http://flr-project.org). FLQuant is
an extension to array. There is an as.data.frame method that coerces
flquant
On 8/24/05, ernesto [EMAIL PROTECTED] wrote:
Hi,
I'm trying to develop an histogram method for a class called FLQuant
which is used by the package FLCore (http://flr-project.org). FLQuant is
an extension to array. There is an as.data.frame method that coerces
flquant into a data.frame
I think you can use barplot for what you want.
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Depire Alexandre
Sent: June 3, 2005 12:14 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Histogram of multiple series on one histogram
Hello,
I have three
Something like this!?!?
Rnew
a
[1,] 10 1
[2,] 20 1
[3,] 10 1
[4,] 20 1
[5,] 30 1
[6,] 10 2
[7,] 20 2
[8,] 20 2
[9,] 30 2
[10,] 30 2
[11,] 20 3
[12,] 20 3
[13,] 10 3
Rbarplot(table(new[,2],new[,1]),beside=T,legend.text=c(a,b,c))
-Original Message-
From: [EMAIL PROTECTED]
Hello alexandre,
what you are trying to do is *not* an histogram (as a density
estimator), if you divide each bar in 3, the surfaces of a won't sum to 1.
However a barplot or a barplot2 (in package gplots, bundle gregmisc)
would do the trick.
See graph 54 on the graph gallery :
Dear Paul,
On May 5, 2005, at 6:43 AM, Paul Smith wrote:
Dear All
I would like to get the histogram for the following model with
discrete and continuous random variables:
* with probability 1/3, a random number is drawn from the continuous
uniform distribution (min=0, max=1);
* with probability
See http://finzi.psych.upenn.edu/R/Rhelp02a/archive/48428.html
Andy
From: Paul Smith
Dear All
I would like to get the histogram for the following model with
discrete and continuous random variables:
* with probability 1/3, a random number is drawn from the continuous
uniform
On Wed, 20 Apr 2005 17:37:04 +0200 Mag. Ferri Leberl wrote:
Dear everybody!
I am analysing data from an enquette. The answers are either A or B.
How can I draw a histogram without transforming the data from
characters to numbers? If the data are saved in a list M, hist(M[,1])
returns:
Mag. Ferri Leberl [EMAIL PROTECTED] writes:
Dear everybody!
I am analysing data from an enquette. The answers are either A or B. How can
I
draw a histogram without transforming the data from characters to numbers? If
the data are saved in a list M, hist(M[,1]) returns:
Error in
From: Mag. Ferri Leberl
Dear everybody!
I am analysing data from an enquette. The answers are either
A or B. How can I
draw a histogram without transforming the data from
characters to numbers? If
the data are saved in a list M, hist(M[,1]) returns:
Error in hist.default(M[, 1]) :
As Achim said, I would use a barplot instead of an hist.
Here's how I would do it:
vect-c(a,b,a,b,b,b,a,a,a)
a-length(vect[vect==a])
b-length(vect[vect==b])
barplot(c(a,b),names.arg=(c(A,B)))
Neuro the Super Hero
From: Mag. Ferri Leberl [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To:
AM
To: '[EMAIL PROTECTED]'; r-help@stat.math.ethz.ch
Subject: RE: [R] Histogram
From: Mag. Ferri Leberl
Dear everybody!
I am analysing data from an enquette. The answers are either
A or B. How can I
draw a histogram without transforming the data from
characters to numbers
, 21 April 2005 10:06 AM
To: Mulholland, Tom
Subject: RE: [R] Histogram
Have you tried it? hist.factor() as defined would be the
hist method for
the factor class, so hist(f) would work if f is a factor.
Andy
From: Mulholland, Tom
Of course Andy meant hist.factor(f
Have you looked at the CircStats and circular? They have some plotting
functions that may be of help to you.
Greg Snow, Ph.D.
Statistical Data Center
[EMAIL PROTECTED]
(801) 408-8111
Dubravko Dolic [EMAIL PROTECTED] 03/24/05 09:38AM
Dear Group,
Having a character vector like this one:
I do analyses of that sort all the time with air quality data where I wish
to begin to understand daily behavior -- works well in doing model
evaluation as well.
I'd say your approach should give you useful information; however, I'd
think you'd also be interested in a possible day of week
Cézar Freitas wrote:
Hi, all. I need plot a boxplot under a histogram like
below, but some configs are troubled:
- the boxplot contours the plot, even if I put
bty=n, modifying the histogram plot;
You want to set axes = FALSE in boxplot()
BTW: What is q[4] in your call to points()?
Uwe Ligges
-
A histogram is a density estimate (at least as defined in the Encyclopedia
of Statistics Sciences, if not in many US Universities). It is an area,
not a series of unrelated bars, so it makes no sense to have spaces
between the subareas.
Unfortunately, hist() will also produce barplots of
Tom,
I dealt with this once.
barplot.data- c(2,3,4,5,6)
x- barplot(barplot.data, ylim = c(0,10), space= .9,.9,.9,.9)
use the space= to define the spacing between each of your barplot values.
If you have groups of bars that you want together, with spaces between the
groups,
you have to put
I understand the problem from a statistical perspective, and you make
an excellent point (as I have come to expect, reading this list).
However, I'm thinking about it from a visual/aesthetic perspective.
Let me try this. Plot two histograms side-by-side:
x - rnorm(10)
par(mfcol=c(1,2))
I see where you're going...yes, I could create my own histogram
distribution from the data and plot it using barplot (in fact, I've
already achieved the visual effect I want with barplot, so I could just
expand on that). I'm hoping that I can find a way to do it with hist()
to avoid
A hint: hist() does no plotting. That is done by the histogram method
of plot(), which you can copy and modify to your own needs/desires.
Alternatively you can create myplot() and call
myplot(hist(..., plot=TRUE), ...)
On Wed, 9 Feb 2005, Thomas Hopper wrote:
I understand the problem from a
x is not a numeric vector, so R doesn't know how to take a histogram.
Here are your clues:
class(x)
[1] data.frame
is.numeric(x)
[1] FALSE
so, try
names(x)
I speculate that LOGT is contained in the dataframe x. If so, try
hist(x$LOGT)
I hope that this helps.
Andrew
On Tue, Jan 04,
Ross Darnell wrote:
Is it possible to produce a histogram directly using the hist()
function with the common borders removed?
It can be done by plotting the histogram object using type 's'teps.
my.hist - hist(x,plot=FALSE)
plot(my.hist$breaks,c(0,my.hist$counts),type='s')
Hello Ross,
I think, your
Cristian Pattaro wrote:
Dear all,
I have a surprising problem with the representation of frequencies in a
histogram.
Consider, for example, the R code:
b-rnorm(2000,3.5,0.3)
hist(b,freq=F)
When I plotted the histogram, I expected that values in the y-axis (the
probability) varied between 0 and
On Tue, 25 May 2004 12:27:40 +0200 Cristian Pattaro wrote:
Dear all,
I have a surprising problem with the representation of frequencies in
a histogram.
Consider, for example, the R code:
b-rnorm(2000,3.5,0.3)
hist(b,freq=F)
When I plotted the histogram, I expected that values in
On 25-May-04 Cristian Pattaro wrote:
I have a surprising problem with the representation of
frequencies in a histogram.
Consider, for example, the R code:
b-rnorm(2000,3.5,0.3)
hist(b,freq=F)
When I plotted the histogram, I expected that values in
the y-axis (the probability) varied
Mateusz == Mateusz £oskot [EMAIL PROTECTED]
on Sun, 18 Apr 2004 17:13:34 +0200 writes:
Mateusz Hi Christophe, On 4/18/2004 3:17 PM, Christophe
Mateusz Pallier wrote:
The 'hist' function works on the raw data. In your data
set example, you have already computed the number
?hist reveals argument plot=TRUE, so try plot=FALSE.
On Mon, 19 Apr 2004, Randy Zelick wrote:
Hello all,
Relative to WinXP R1.8
No such thing. There is R 1.8.0 and R 1.8.1 but not R 1.8.
I have two histograms to plot, and for comparison purposes I want them to
have the same
Hello Mateusz,
The 'hist' function works on the raw data.
In your data set example, you have already computed the number of data
points in each bin.
What you really want is probably a barplot of N
You could display your data:
plot(Class,N,'h')
Or
names(N)-Class
barplot(N)
Christophe Pallier
Hi Christophe,
On 4/18/2004 3:17 PM, Christophe Pallier wrote:
The 'hist' function works on the raw data.
In your data set example, you have already computed the number of data
points in each bin.
Yes, you are right. I evidently misunderstood the hist function
usage described in manuals.
What
Mathieu -
That's easy. Assign the return value of hist() to some
variable, say fixed, then go in and hack the value of
fixed$counts however you like, and re-plot using plot(fixed).
Example code:
fixed - hist(rnorm(2000))
fixed$counts - fixed$counts / 5
plot(fixed)
I confess I didn't quite
plot(table(factor(x,levels=c(c,b,a
is at least approximately what you want (the only complicated bit is
reversing the order of the bars from the default alphabetical order)
substituting barplot() for plot() also works
you may want to use ylab=something in the plot or barplot command to
On 18 Nov 2003, Arend P. van der Veen wrote:
Hi,
I have what should be a simple question. I would like to generate a
histogram of
x - c(a,b,c,b,c,c)
where the first bar to be labeled 'c' with height 3, second bar to be
labeled 'b' with height 2 and third bar to be labeled 'a' with
Arend P. van der Veen wrote:
(B Hi,
(B
(B I have what should be a simple question. I would like to generate a
(B histogram of
(B
(B x - c("a","b","c","b","c","c")
(B
(B where the first bar to be labeled 'c' with height 3, second bar to be
(B labeled 'b' with height 2 and third bar to be
Arend P. van der Veen [EMAIL PROTECTED] writes:
Hi,
I have what should be a simple question. I would like to generate a
histogram of
x - c(a,b,c,b,c,c)
where the first bar to be labeled 'c' with height 3, second bar to be
labeled 'b' with height 2 and third bar to be labeled 'a' with
On 18 Nov 2003 10:29:50 -0500, Arend P. van der Veen
[EMAIL PROTECTED] wrote :
Hi,
I have what should be a simple question. I would like to generate a
histogram of
x - c(a,b,c,b,c,c)
where the first bar to be labeled 'c' with height 3, second bar to be
labeled 'b' with height 2 and third bar
You can do it by hand; e.g.,
x - rnorm(50)
x.hist - hist(x, prob=TRUE, plot=FALSE)
x.prob - x.hist$count / length(x)
## Alternatively:
x.prob - diff(x.hist$breaks) * x.hist$density
You can then use barplot or whatever you like to plot x.prob.
HTH,
Andy
-Original Message-
From: Erin
?hist says
breaks: one of:
...
* a single number giving the number of cells for the
histogram,
...
In the last three cases the number is a suggestion only.
On Fri, 27 Jun 2003, Tommy E. Cathey wrote:
Why does the following code generate a Histogram
77 matches
Mail list logo