[R] Subset returning unexpected result

Peter Ehlers ehlers at ucalgary.ca
Fri Oct 16 19:12:57 CEST 2009


Steve Murray wrote:
>  <FA3C85AC-06AB-4635-9642-8909552C0776 at comcast.net>
> Content-Type: text/plain; charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
> MIME-Version: 1.0
> 
> 
> Bill=2C
> 
> It seems to be 'character' - odd...!

Not really very "odd". I'll wager that your data was
originally recorded in Excel or equivalent and that
the column for 'latitude' was in 'general' format,
which is MS's default and which very few Excel users
seem to take the trouble to change to 'number' format.
I'll further wager that somewhere in that column you
have a non-number entry such as 'nil', '51..345' or
even 'could not be measured because ...'. Don't laugh,
I've see all of these and many more. That's why it's
critical to issue a str(mydata) right after any data
import.

Cheers,
Peter Ehlers

> 
>> str(int1901$Latitude)
> =A0chr [1:61537] "5.75" "6.25" "6.75" "7.25" "7.75" "8.25" ...
> 
> Thanks again=2C
> 
> Steve
> 
> 
> 
>> What does str(int1901) show to be the type for Latitude? (I'm guessing
>> it's a factor.)
>>
>> --
>>
>> David Winsemius=2C MD
>> Heritage Laboratories
>> West Hartford=2C CT
>>
>  		 	   		 =20
> 
> ______________________________________________
> 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.
> 
>




More information about the R-help mailing list