[R] numbers not behaving as expected

Steve_Friedman at nps.gov Steve_Friedman at nps.gov
Thu Apr 9 20:05:46 CEST 2009


My apologies for sending a binary file.  I was following advice from
someone (from this list) who insisted I send data via dput.  I guess that
is frown upon.

Anyway.  here is a Cellave.txt file.


Stavros,  here is the output following your suggestion.

WetMonths <- Cell.ave[Cell.ave$month  >= "5" and Cell.ave$month <= "11",]
Error: unexpected symbol in "WetMonths <- Cell.ave[Cell.ave$month  >= "5"
and"  Cell.ave$month <= "11",]

I think the problem lies in leading characters for months with values 1,
10, 11, and 12.  These get very confused.


(See attached file: Cellave.txt)

Steve Friedman Ph. D.
Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034

Steve_Friedman at nps.gov
Office (305) 224 - 4282
Fax     (305) 224 - 4147


                                                                           
             Stavros Macrakis                                              
             <macrakis at alum.mi                                             
             t.edu>                                                     To 
             Sent by:                  Steve_Friedman at nps.gov              
             macrakis at gmail.co                                          cc 
             m                         r-help at r-project.org                
                                                                   Subject 
                                       Re: [R] numbers not behaving as     
             04/09/2009 01:51          expected                            
             PM AST                                                        
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




On Thu, Apr 9, 2009 at 1:39 PM,  <Steve_Friedman at nps.gov> wrote:
> I have a data.frame Cell.ave (attached and created via dput(Cell.ave,
> "Cell.ave")

I'm afraid your attachment didn't make it into the r-help mail.
Mailing list policy forbids binary attachments other than PS and PDF,
but should be forwarding plaintext attachments, I think.  Perhaps it
requires that the extension be ".txt" or something...?

Anyway... the problem seems diagnosable just from your code:

> WetSeasonMonths <- Cell.ave[Cell.ave$month  >= "5" & Cell.ave$month <=
> "11",]

There is no *string* which is >= "5" and <= "11".  Why aren't you
comparing numerically?

             -s


More information about the R-help mailing list