How to produce this graphic

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to produce this graphic

Lisa Wang
Hello there,

I would like to produce a plot of x<-c(4,5,6),which is the mean of each
group and y<-c('groupA','groupB','groupC').

plot (x,y) can not produce any graphics because y is not numerical.

What should I do to produce this graphic?


Thank you in advance

Lisa Wang
Princess Margaret Hospital
Toronto,Ca

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: How to produce this graphic

Kort, Eric


Lisa Wang asks...
> Subject: [R] How to produce this graphic
>
> Hello there,
>
> I would like to produce a plot of x<-c(4,5,6),which is the mean of
each
> group and y<-c('groupA','groupB','groupC').
>
> plot (x,y) can not produce any graphics because y is not numerical.
>
> What should I do to produce this graphic?
>

One possibility:
x <- c(4,5,6)
plot(x, axes=F)
axis(1, c(1:3), labels=y)

or see ?bar.plot

-Eric

>
> Thank you in advance
>
> Lisa Wang
> Princess Margaret Hospital
> Toronto,Ca
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-
> guide.html
This email message, including any attachments, is for the so...{{dropped}}

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: How to produce this graphic

Duncan Murdoch
In reply to this post by Lisa Wang
On 1/4/2006 12:30 PM, Lisa Wang wrote:
> Hello there,
>
> I would like to produce a plot of x<-c(4,5,6),which is the mean of each
> group and y<-c('groupA','groupB','groupC').
>
> plot (x,y) can not produce any graphics because y is not numerical.
>
> What should I do to produce this graphic?

dotchart(x,y) does a nice job.  See ?dotchart for a lot of optional
arguments to change the look of it.

Duncan Murdoch

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: How to produce this graphic

Robert Baer
In reply to this post by Kort, Eric
----- Original Message -----
From: "Kort, Eric"  

> Lisa Wang asks...
>> Subject: [R] How to produce this graphic
>> Hello there,
>> I would like to produce a plot of x<-c(4,5,6),which is the mean of
> each
>> group and y<-c('groupA','groupB','groupC').
>> plot (x,y) can not produce any graphics because y is not numerical.
>> What should I do to produce this graphic?
>
> One possibility:
> x <- c(4,5,6)
> plot(x, axes=F)
> axis(1, c(1:3), labels=y)
>
> or see ?bar.plot

I think Eric meant: ?barplot

For example:
barplot(x, names.arg=y)

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html