<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
James Nylen a &eacute;crit&nbsp;:
<blockquote
 cite="mid:205a4c310811170842i95c5174qb9f32fa14c43c5ad@mail.gmail.com"
 type="cite">
  <div>The easiest thing to do&nbsp;is probably&nbsp;to write the data.frame to a
tab-delimited text file using write.table and then read in the written
file like you have done above.&nbsp; See ?write.table - as I recall there
are plenty of options that will allow you to specify the separator,
whether or not to write headings, etc.</div>
  <div>&nbsp;</div>
  <div>-James</div>
</blockquote>
This is exactly what I did yesterday (see script below - the function
uploadEtrex is now at the working stage in a package pgirbirc at
<a class="moz-txt-link-freetext" href="http://pagesperso-orange.fr/giraudoux/">http://pagesperso-orange.fr/giraudoux/</a> or
<a class="moz-txt-link-freetext" href="http://pagesperso-orange.fr/giraudoux/#pgirbric">http://pagesperso-orange.fr/giraudoux/#pgirbric</a>)<br>
<br>
However when I think about it, my question was a bit silly: it was
something as how to send a r-object to a connexion that a batch script
could read at the operating system level without writing a file on
disk... I guess there is no solution and the easiest way, indeed, is to
write a text file and make it read from the shell (which is what the
current fonction does...).<br>
<br>
Thanks anyway for your input,<br>
<br>
Patrick<br>
<br>
<br>
uploadEtrex &lt;- function (df, wcom = 4) <br>
{<br>
&nbsp;&nbsp;&nbsp; dff &lt;- as.data.frame(matrix(NA, nrow = nrow(df), ncol = 9))<br>
&nbsp;&nbsp;&nbsp; dff[, c(2, 8, 9)] &lt;- df[, c(1, 3, 2)]<br>
&nbsp;&nbsp;&nbsp; write.table(dff, "dff", col.names = FALSE, sep = "\t", quote =
FALSE)<br>
&nbsp;&nbsp;&nbsp; if (Sys.info()["sysname"] != "Windows") {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; system(paste("gpsbabel -w -i tabsep -f dff -o garmin -F
/dev/ttyUSB0", <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sep = ""))<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; else {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; system(paste("gpsbabel -w -i tabsep -f dff -o garmin -F com", <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wcom, ":", sep = ""))<br>
&nbsp;&nbsp;&nbsp; }<br>
}<br>
<br>
<blockquote
 cite="mid:205a4c310811170842i95c5174qb9f32fa14c43c5ad@mail.gmail.com"
 type="cite">
  <div><br>
  <br>
&nbsp;</div>
  <div><span class="gmail_quote">On 11/16/08, <b
 class="gmail_sendername">Patrick Giraudoux</b> &lt;<a
 moz-do-not-send="true" href="mailto:patrick.giraudoux@univ-fcomte.fr">patrick.giraudoux@univ-fcomte.fr</a>&gt;
wrote:</span>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">Dear
listers,<br>
    <br>
I am writing a R function to upload waypoints to a GPS Garmin Etrex
with &nbsp;gpsbabel. This works quite well reading from a text file as
following:<br>
    <br>
df&lt;-"mytabfile.txt"<br>
system(paste("gpsbabel -w -i tabsep -f ",df," -o garmin -F
com5:",sep=""))<br>
    <br>
However, I would prefer to upload from a data.frame within R rather
than reading a tab delimited text file on the disk.<br>
    <br>
Any idea about how to specify it in the command line (should be
trivial, but I cannot figure it out) ?<br>
    <br>
Thanks in advance,<br>
    <span class="sg"><br>
Patrick<br>
    <br>
    <br>
    </span><br>
_______________________________________________<br>
R-sig-Geo mailing list<br>
    <a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="mailto:R-sig-Geo@stat.math.ethz.ch">R-sig-Geo@stat.math.ethz.ch</a><br>
    <a moz-do-not-send="true"
 onclick="return top.js.OpenExtLink(window,event,this)"
 href="https://stat.ethz.ch/mailman/listinfo/r-sig-geo" target="_blank">https://stat.ethz.ch/mailman/listinfo/r-sig-geo</a><br>
    <br>
    <br clear="all">
  </blockquote>
  </div>
  <br>
</blockquote>
<br>
</body>
</html>