> On Oct 9, 2019, at 9:58 AM, Rui Barradas wrote:
>
> Hello,
>
> Here are 3 ways.
>
For a large number of bars, sometimes this:
plot( y, type='h') # maybe use lwd=5
Chuck
> The first are almost the same, they use base graphics.
>
> x <- 1:6
> y <- c(73,53,42,67,41,50)
>
> barplot(setN
140)) )
>
> #Also works equidistant with default 0:length(counts) breaks:
>
> f2 <- c(30, 39, 31, 29, 10, 6, 3, 1, 0, 1)
> plot(freqhist(f2))
>
> Steve E
>
>
> > -----Original Message-----
> > From: Stephen Ellison
> > Sent: 09 Octob
Hello,
Here are 3 ways.
The first are almost the same, they use base graphics.
x <- 1:6
y <- c(73,53,42,67,41,50)
barplot(setNames(y, x))
Or
names(y) <- x
barplot(y)
And 3:
library(ggplot2)
ggplot(data.frame(x, y), aes(x, y)) +
geom_col()
Hope this helps,
Rui Barradas
Às 16:12 de 0
Aargh of course - so obvious I'd completely overlooked that.>. Thanks Nick
> On 09 October 2019 at 16:21 Ivan Krylov wrote:
>
>
> On Wed, 9 Oct 2019 16:12:57 +0100 (BST)
> Nick Wray via R-help wrote:
>
> > I have a vector like say 73,53,42,67,41,50 where these numbers are
> > the number of oc
nt: 09 October 2019 17:29
> To: 'Nick Wray'; r-help@r-project.org
> Subject: RE: [R] Creating a histogram from a frequency vector
>
> > I have a vector like say 73,53,42,67,41,50 where these numbers are the
> > number of occurrences of the data values 1,2,3,4,5,6 - so
> I have a vector like say 73,53,42,67,41,50 where these numbers are the
> number of occurrences of the data values 1,2,3,4,5,6 - so in essence I have
> the frequency bit from the hist() function. I can't see an elegant way (there
> are clearly messy workarounds like generating a vector of 73 1's,
On Wed, 9 Oct 2019 16:12:57 +0100 (BST)
Nick Wray via R-help wrote:
> I have a vector like say 73,53,42,67,41,50 where these numbers are
> the number of occurrences of the data values 1,2,3,4,5,6
> I can't see an elegant way <...> of creating a histogram from this
> data set. Is there one?
A h
7 matches
Mail list logo