Re: [R] Replacing backslashes with slashes

From: yvonnick noel <yvonnick.noel_at_uhb.fr>
Date: Thu 05 Jan 2006 - 04:54:08 EST

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

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jan 05 06:59:07 2006

This archive was generated by hypermail 2.1.8 : Thu 05 Jan 2006 - 11:00:59 EST