[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:

library(Rpad)
Rpad("example.Rpad")

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 :

print(datafile)

This is the way I get this string.

Yvonnick.

Here is the script :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
  <head>
    <title>An example</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso8859-1">
    <script type="text/javascript" src="editor/Rpad_loader.js">
    </script>
  </head>
  <body>
  <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>
  <span class="wrapperForHidden" contenteditable="false">
    <div class="Rpad_input" rpad_type="R" style="DISPLAY: none">
      <pre>
        # This is the R code
        if(exists("datafile")){
        print(datafile)
        }
      </pre>
    </div>
  </span>
  <hr>
  </body>
</html>




More information about the R-help mailing list