[R] help error histograma

John Kane jrkrideau at inbox.com
Fri Aug 10 16:53:37 CEST 2012


   Thank you but it is not a good idea to send attachments.  I received them
   because the email came directly to me butw probablyw others did not because
   the R-list usually removes them to protect against viruses.  It is better to
   put everything in the email.
   I have included your  code and data below.
   I  do not understand what some of your code is doing but the immediate
   problem is that your data has a range of 0 - 109 and you have a seq of
   seq(0,80,0.5) in the hist command
   Change to seq(0,110,0.5) and it should work.
   What is this supposed to do?
   is.na(dados) <- dados == -999.9



   John Kane
   Kingston ON Canada
   #=============Original Code=====================#

   library(MASS)
   dados<-read.table("/home/john/rdata/pelotas.txt",header=FALSE)
   is.na(dados) <- dados == -999.9  # what the devil? jrk
   png(filename="teste1.png",width=600,height=600)
   par(mfrow=c(2,1))
   #breaks<- seq(0,max(dados[[1]],by=0.5))
   hist(dados[[1]],seq(0,110,0.5),         prob=TRUE),        xlab="chuva
   (mm/dia)",ylab="frequência",           main="",           cex.lab=1.6,
   cex.sub=3,cex.axis=3,cex.main=6)
    # calculo do quantil ou percentil de 90%
   q=quantile(dados[1],0.90,na.rm=T)
   #===============================================
   dados  <-   dput(dados)
   structure(list(V1 = c(0, 0.4, 0, 0, 0.4, 0, 0, 0, 0, 0, 1, 0,
   0, 0.4, 5, 16, 0, 6.6, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 9.8,
   10.6, 5.6, 2.2, 3.2, 0, 0, 0.1, 0.3, 0, 15.8, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30.5, 0, 0, 2.2, 44.8, 20.6,
   9, 3.6, 2.2, 0, 0.6, 0, 0, 0, 0, 0, 0, 0, 13.2, 0.6, 0, 0, 0,
   0, 0, 21.4, 0, 0, 3.4, 6.4, 0, 0, 0, 1, 0, 0, 0, 1.4, 0, 0, 0,
   0, 0, 7, 0.2, 1.4, 0, 0, 0, 13.4, 18.6, 3.6, 7, 1.7, 0, 0, 0,
   0, 0, 0, 0.2, 0, 0, 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102, 0, 4.8,
   0, 0, 1.6, 0, 0, 65.2, 0.6, 0, 0.4, 0, 0, 0, 0.4, 5.4, 2, 0,
   0, 0, 0, 0, 0, 2.6, 4.2, 0, 0, 14.4, 0, 0, 0, 0, 0, 0, 18.2,
   0, 0, 0, 0, 0, 0, 5, 3.2, 26.4, 16.4, 0, 0, 0, 0, 0, 0, 0, 0,
   1.2, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29.2, 51.6,
   2.6, 0, 0, 1.8, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5.8, 8.6, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 11.8, 0, 21.6, 41.6, 21.4, 0.3, 0, 3.6,
   0, 0.8, 0, 0, 1.8, 0, 1.6, 6.4, 0.2, 0, 0, 7.6, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 6.8, 0, 0, 0, 0, 0, 13.4, 8.4, 2, 0, 0, 0, 0, 9.6,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7.6, 9.8, 2.2, 0, 17.4, 2, 1.4,
   0.6, 0.2, 0, 0, 0, 14.2, 0, 0, 22, 0, 17.8, 0, 7.4, 0, 0, 0,
   11.2, 0, 0, 0, 4.2, 0, 39, 13.2, 0.2, 0, 2.2, 0.3, 0, 0, 0, 0,
   0, 3.2, 0, 0, 0, 0, 0, 0.4, 0.8)), .Names = "V1", class = "data.frame",
   row.names = c(NA,
   -1214L))

   -----Original Message-----
   From: aprendizprogram at hotmail.com
   Sent: Fri, 10 Aug 2012 17:08:17 +0300
   To: jrkrideau at inbox.com, r-help at r-project.org
   Subject: RE: [R] help error histograma

   is attached data and script
   > Date: Fri, 10 Aug 2012 05:53:45 -0800
   > From: jrkrideau at inbox.com
   > Subject: Re: [R] help error histograma
   > To: aprendizprogram at hotmail.com; kridox at ymail.com; r-help at r-project.org
   >
   >  You  probably  need  to  post  the  data here, or somewhere such as
   [url=http://www.mediafire.com/][b]MediaFire[/b][/url] for other readers to
   examine.
   >
   > To post it here use dput() and paste the results into the email.
   >
   > John Kane
   > Kingston ON Canada
   >
   >
   > > -----Original Message-----
   > > From: aprendizprogram at hotmail.com
   > > Sent: Fri, 10 Aug 2012 16:08:16 +0300
   > > To: kridox at ymail.com, r-help at r-project.org
   > > Subject: Re: [R] help error histograma
   > >
   > >
   > > Hi,
   > > I checked using the summary, and my data has 1000 elementsranging from 0
   > > to 30 (values)
   > > but I do not understand the error
   > >
   > >
   > >> Date: Fri, 10 Aug 2012 11:18:01 +0900
   > >> From: kridox at ymail.com
   > >> To: aprendizprogram at hotmail.com
   > >> CC: r-help at r-project.org
   > >> Subject: Re: [R] help error histograma
   > >>
   > >> Hello,
   > >>
   > >> David L Carlson already suggested to you to check the range of your
   > >> data. Did you do it?
   > >>
   > >> Regards
   > >>
   > >>
   > >>
   > >> Le 10/08/2012 09:36, aprendiz programa a icrit :
   > >>>
   > >>> Hi,
   > >>> My error isErro em hist.default(dados[[1]], freq = TRUE, seq(0, 30,
   > >>> 0.5), prob = FALSE, : some 'x' not counted; maybe 'breaks' do not
   > >>> span range of 'x'
   > >>> hist(dados[[1]],seq(0, 30, 0.5), prob=TRUE, xlab="chuva
   > >>> (mm/dia)",ylab="frequjncia", main="", cex.lab=1.6,
   > >>> cex.sub=3,cex.axis=3,cex.main=6)
   > >>> Someone help me?
   > >>> [[alternative HTML version deleted]]
   > >>>
   > >>>
   > >>>
   > >>> ______________________________________________
   > >>> R-help at 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 at 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.
   >
   > ____________________________________________________________
   > FREE ONLINE PHOTOSHARING - Share your photos online with your friends and
   family!
   > Visit http://www.inbox.com/photosharing to find out more!
   >
   >
     _________________________________________________________________

   [1]Smileys Preview 
   Get   Free   Smileys   for   Your   IM   &   Email  -  Learn  more  at
   [2]www.crawler.com/smileys
   Works  with  AIM^®, MSN^® Messenger, Yahoo!^® Messenger, ICQ^®, Google
   Talk^™ and most webmails

References

   1. http://www.inbox.com/smileys
   2. http://www.crawler.com/smileys


More information about the R-help mailing list