Re: [R] draw categorical histogram

2010-12-01 Thread Andrew Miles

Try:

plot (myCatVariable)

Andrew Miles
Department of Sociology
Duke University

On Dec 1, 2010, at 2:51 PM, phoebe kong wrote:


Hi,

Can someone tell me how to draw a histogram for the following summary?

Richard   Minnie  Albert  Helen  Joe  Kingston
   1233   56   6715   66

The summary tell that Richard has occurrence 12, Minnie has  
occurrence 33,

and so on. I would like to view this summary in a histogram.

I want the X-axis be the person name (Richard, Minnie, ), Y-axis  
be the

frequency (12, 33).
How can I make the histogram has 6 bars, each bar was named as  
Richard,

Minnie, ... ,  Kingston?

Thanks,
Phoebe

[[alternative HTML version deleted]]

__
R-help@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.


__
R-help@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.


Re: [R] draw categorical histogram

2010-12-01 Thread phoebe kong
This would not draw a histogram.

On Wed, Dec 1, 2010 at 11:54 AM, Andrew Miles rstuff.mi...@gmail.comwrote:

 Try:

 plot (myCatVariable)

 Andrew Miles
 Department of Sociology
 Duke University


 On Dec 1, 2010, at 2:51 PM, phoebe kong wrote:

  Hi,

 Can someone tell me how to draw a histogram for the following summary?

 Richard   Minnie  Albert  Helen  Joe  Kingston
   1233   56   6715   66

 The summary tell that Richard has occurrence 12, Minnie has occurrence 33,
 and so on. I would like to view this summary in a histogram.

 I want the X-axis be the person name (Richard, Minnie, ), Y-axis be
 the
 frequency (12, 33).
 How can I make the histogram has 6 bars, each bar was named as Richard,
 Minnie, ... ,  Kingston?

 Thanks,
 Phoebe

[[alternative HTML version deleted]]

 __
 R-help@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@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.


Re: [R] draw categorical histogram

2010-12-01 Thread Jorge Ivan Velez
Hi Phoebe,

Try

x - c(12, 33, 56, 67, 15, 66)
names(x) - c('Richard','Minnie','Albert','Helen','Joe','Kingston')
barplot(x, las = 1, space = 0)

HTH,
Jorge


On Wed, Dec 1, 2010 at 2:51 PM, phoebe kong  wrote:

 Hi,

 Can someone tell me how to draw a histogram for the following summary?

 Richard   Minnie  Albert  Helen  Joe  Kingston
1233   56   6715   66

 The summary tell that Richard has occurrence 12, Minnie has occurrence 33,
 and so on. I would like to view this summary in a histogram.

 I want the X-axis be the person name (Richard, Minnie, ), Y-axis be the
 frequency (12, 33).
 How can I make the histogram has 6 bars, each bar was named as Richard,
 Minnie, ... ,  Kingston?

 Thanks,
 Phoebe

[[alternative HTML version deleted]]

 __
 R-help@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@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.


Re: [R] draw categorical histogram

2010-12-01 Thread Andrew Miles

Phoebe,

In addition to the barplot method below, you really can use plot() to  
draw what it sounds like you are looking for IF you have a categorical  
variable.  To illustrate, try running the following code:


x=sample(c(Richard, Minnie, Albert, Helen, Joe, Kingston),  
50, replace=T)

x=as.factor(x)
plot(x)

See also ?plot.factor

Andrew Miles


On Dec 1, 2010, at 4:06 PM, Jorge Ivan Velez wrote:


Hi Phoebe,

Try

x - c(12, 33, 56, 67, 15, 66)
names(x) - c('Richard','Minnie','Albert','Helen','Joe','Kingston')
barplot(x, las = 1, space = 0)

HTH,
Jorge


On Wed, Dec 1, 2010 at 2:51 PM, phoebe kong  wrote:


Hi,

Can someone tell me how to draw a histogram for the following  
summary?


Richard   Minnie  Albert  Helen  Joe  Kingston
  1233   56   6715   66

The summary tell that Richard has occurrence 12, Minnie has  
occurrence 33,

and so on. I would like to view this summary in a histogram.

I want the X-axis be the person name (Richard, Minnie, ), Y- 
axis be the

frequency (12, 33).
How can I make the histogram has 6 bars, each bar was named as  
Richard,

Minnie, ... ,  Kingston?

Thanks,
Phoebe

  [[alternative HTML version deleted]]

__
R-help@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@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.


__
R-help@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.