[R] ReadLines question

Jonathan Greenberg jgreenberg at arc.nasa.gov
Sat Oct 21 20:02:27 CEST 2006


That looks to me like an infinity sign (I have no idea why that is part of
the header of this file, but it is there).  How do I modify the encoding to
read this in? 

--j


On 10/21/06 4:33 AM, "Roger Bivand" <Roger.Bivand at nhh.no> wrote:

> On Sat, 21 Oct 2006, Jonathan Greenberg wrote:
> 
>> I'm getting the following error:
>> 
>>> headerinfo=readLines(met_station_file,n=8)
>>> headerinfo
>> [1] "Plot Title: tahoe met validation ,,,,,,,"
>> [2]Error: invalid multibyte string
>             ^^^^^^^^^^^^^^^^^^^^^^^^
> 
>> 
>> met_station_file's first 8 lines are as follows:
>> 
>> Plot Title: tahoe met validation ,,,,,,,
>> #,"Time, GMT-07:00","Temp, ƒF",Coupler Attached,Host Connected,Coupler
>                              ^^^
> 
> or whatever this looks like to you (was ^Ã for me in LC_CTYPE=en_GB) is a
> multibyte string. Is there a mismatch between the encoding (see ?locales)
> of the file and the machine into which you are reading?
> 
>> Detached,Stopped,End Of File
>> 34,10/1/2005 0:00,49.937,,,,,
>> 35,10/1/2005 0:30,47.266,,,,,
>> 36,10/1/2005 1:00,47.446,,,,,
>> 37,10/1/2005 1:30,47.982,,,,,
>> 38,10/1/2005 2:00,48.517,,,,,
>> 39,10/1/2005 2:30,49.228,,,,,
>> 
>> Why am I getting this error?  Are those quotation marks causing the hiccup?
>> If so, how do I get around this programmatically?
>> 
>> --j
>> 
>> 


-- 
Jonathan A. Greenberg, PhD
NRC Research Associate
NASA Ames Research Center
MS 242-4
Moffett Field, CA 94035-1000
Office: 650-604-5896
Cell: 415-794-5043
AIM: jgrn307
MSN: jgrn307 at hotmail.com



More information about the R-help mailing list