[R] Replacing backslashes with slashes

yvonnick noel yvonnick.noel at uhb.fr
Wed Jan 4 18:54:08 CET 2006

> You really don't understand what I wrote (and it is in many places in 
> the R documentation).  How are you getting that string into R?

OK. A practical example is probably necessary here. I have rewritten a small
Rpad page to show you what I mean. It is copied at the end of this post.

Just save it under your current R directory, under the name, say,
"example.Rpad", and then:


Your browser will open and display the page (I tried it with Mozilla Firefox).
Then browse your disk using the browse button and select any file. Then click
the "Print the name" button.

The full file name is sent to R and internally stored in the R variable
"datafile". The embedded R code is just :


This is the way I get this string.


Here is the script :

    <title>An example</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso8859-1">
    <script type="text/javascript" src="editor/Rpad_loader.js">
  <H1>Load data</H1>
  <h3><a name="fil"> From a local or remote file </a></h3>
  <span contenteditable="false">
    <p><input type="file" name="datafile" size="40" class="Rpad_input"
id="datafile" rpad_type="Rstring"></p>
    <P><input type="button" onclick="javascript:top.Rpad_calculate();"
value="Print the name"></p>
  <span class="wrapperForHidden" contenteditable="false">
    <div class="Rpad_input" rpad_type="R" style="DISPLAY: none">
        # This is the R code

More information about the R-help mailing list