Roger Bivand a écrit :
> Patrick,
>
> On Sun, 14 Jan 2007, Patrick Giraudoux wrote:
>
>   
>> Sorry to answer to myself. I have found a solution for the 2nd question: 
>> from R within windows the gps can be read with:
>>
>> shell("gpsbabel -w -i garmin -f com4: -o openoffice -F \"wpt.txt\"")
>>
>>     
>
> Good.
>
>   
>> The 1th question about reading the gps data directly to an R object 
>> unstead of a text file is still unanswered...
>>
>>     
>
> Since the files are not too large, would pasting an R temporary file into 
> the system call, and then reading from it be a fix?
Yes!!! Excellent idea...
>  I've tried "-" as the 
> file name under Linux, and it does return the data to stdout (terminal 
> screen), but I haven't got any further because on RedHat EL 4 I can't see 
> how to use gpsbabel without being administrator (I've tried both the FC 
> tips on the gpsbabel website with no effect). system(intern=TRUE) should 
> grab that output:
>
> wps <- system("gpsbabel -w -i garmin -f usb: -o tabsep -F -", intern=TRUE)
> wps_df <- read.table(textConnection(wps), fill=TRUE)
>
> but there is a lot of unneeded information there. Could the xcsv format be 
> used with a suitable style?
>   
I will explore that next week-end. Not to be an administrator seems not 
to be a problem here with Ubuntu.

Anyway using a temporary file may make it for sure if one cannot go 
through with writing straight into R

Thanks a lot for the hint anyway..

Best wishes,

Patrick

> Best wishes,
>
> Roger
>
>
>   
>> Cheers,
>>
>> Patrick
>>
>>
>>
>> Patrick Giraudoux a écrit :
>>     
>>> Dear Listers,
>>>
>>> I am trying to write R fonctions to read data from a gps through 
>>> gpsbabel.
>>>
>>> Within linux I have tried this (read garmin gps and write a tab 
>>> delimited text file wp.txt) and it works well:
>>>
>>> system("gpsbabel -w -i garmin -o openoffice /dev/ttyUSB0 
>>> /home/giraudoux/wp.txt")
>>>
>>> I have two questions:
>>>
>>> 1/ I wonder whether it would be technically possible to open the 
>>> connexion directly to a R object (eg data.frame) rather than to write 
>>> a text file (here wp.txt) ?
>>>
>>> 2/ I wonder how to open a USB device/port within a windows XP 
>>> environment (linux equivalent of /dev/ttyUSB0).
>>>
>>> Thanks in advance for any hint...
>>>
>>> Patrick
>>>
>>>
>>>
>>>       
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo@stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>>     
>
>   


	[[alternative HTML version deleted]]


