[R] Newbie Question About Histograms

2009-01-28 Thread pfc_ivan

Hello everyone. Just have a question , cant figure out how to make this
histogram. 

I have this table, that i stored in a variable name new.data2. Table looks
like this

Year GeoArea SmpNo Month Gear Maturity Length Age YearC
1989   1   36210   221225   1  1988
1991   1   26710   101191   1  1990
1991   1   26710   101202   1  1990
1992   1   3051081162   1  1991
1992   1   3051081165   1  1991
1992   1   3051081166   1  1991
1992   1   3051081167   1  1991
1992   1   3051081167   1  1991
1992   1   3051081169   1  1991
1992   1   3051081170   1  1991

Now I need to make a histogram of Length vs YearC. I would guess that Length
would be on the Y-axis and YearC variable would be on X-axis. I have tried
many different combinations with command 'hist' but im always getting error
 'x' must be numeric  ... I think im getting that error because of the
header which is not numeric. Any help would be appreciated. Thanks guys. 

Ivan.
-- 
View this message in context: 
http://www.nabble.com/Newbie-Question-About-Histograms-tp21713626p21713626.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Newbie Question About Histograms

2009-01-28 Thread Peter Alspach
Kia ora Ivan

I think you might want a barplot.

?hist

under 'See Also:' states:

 Typical plots with vertical bars are _not_ histograms.  Consider
 'barplot' or 'plot(*, type = h)' for such bar plots.
 
[The online help in R is good.]

HTH 

Peter Alspach

 -Original Message-
 From: r-help-boun...@r-project.org 
 [mailto:r-help-boun...@r-project.org] On Behalf Of pfc_ivan
 Sent: Thursday, 29 January 2009 9:04 a.m.
 To: r-help@r-project.org
 Subject: [R] Newbie Question About Histograms
 
 
 Hello everyone. Just have a question , cant figure out how to 
 make this histogram. 
 
 I have this table, that i stored in a variable name 
 new.data2. Table looks like this
 
 Year GeoArea SmpNo Month Gear Maturity Length Age YearC
 1989   1   36210   221225   1  1988
 1991   1   26710   101191   1  1990
 1991   1   26710   101202   1  1990
 1992   1   3051081162   1  1991
 1992   1   3051081165   1  1991
 1992   1   3051081166   1  1991
 1992   1   3051081167   1  1991
 1992   1   3051081167   1  1991
 1992   1   3051081169   1  1991
 1992   1   3051081170   1  1991
 
 Now I need to make a histogram of Length vs YearC. I would 
 guess that Length would be on the Y-axis and YearC variable 
 would be on X-axis. I have tried many different combinations 
 with command 'hist' but im always getting error  'x' must be 
 numeric  ... I think im getting that error because of the 
 header which is not numeric. Any help would be appreciated. 
 Thanks guys. 
 
 Ivan.
 --
 View this message in context: 
 http://www.nabble.com/Newbie-Question-About-Histograms-tp21713
 626p21713626.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 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.
 

The contents of this e-mail are confidential and may be subject to legal 
privilege.
 If you are not the intended recipient you must not use, disseminate, 
distribute or
 reproduce all or any part of this e-mail or attachments.  If you have received 
this
 e-mail in error, please notify the sender and delete all material pertaining 
to this
 e-mail.  Any opinion or views expressed in this e-mail are those of the 
individual
 sender and may not represent those of The New Zealand Institute for Plant and
 Food Research Limited.

__
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] Newbie Question About Histograms

2009-01-28 Thread pfc_ivan


Also I forgot to say that The Y-axis values for each YearC would be the mean
value of all the Lenghts that happen in that YearC. Basically I cant figure
out how to put the mean values of Lengths for each YearC on Y axis. 

Thanks in advance!
-- 
View this message in context: 
http://www.nabble.com/Newbie-Question-About-Histograms-tp21713626p21714995.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Newbie Question About Histograms

2009-01-28 Thread Eik Vettorazzi

How about

 dta-read.table(clipboard,header=T)
 means-aggregate(dta$Length,by=list(YearC=dta$YearC),FUN=mean)
 barplot(means[,2],names.arg=means[,1])

you may have a look at ?barplot to see (lots of) options for fine tuning 
the plot.


hth.

pfc_ivan schrieb:

Also I forgot to say that The Y-axis values for each YearC would be the mean
value of all the Lenghts that happen in that YearC. Basically I cant figure
out how to put the mean values of Lengths for each YearC on Y axis. 


Thanks in advance!



__
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.