On 11/09/2008, at 10:09 AM, Marc Schwartz wrote:

        <snip>

As Prof. Ripley noted, try using debug(RSiteSearch) and then step
through the code to see where $HOME is being added to the URL variable.
That can help pin it down further. If the URL is not corrupted by the
time browseURL() is called, then use debug(browseURL) to trace within
that function to see if something is happening there.

        I have done some digging.  When I do:

        RSiteSearch("logistic regression")

the RSiteSearch() function calls browseURL(qstring) where qstring is qs1 equal to

"http://search.r-project.org/cgi-bin/namazu.cgi?query=logistic +regression&max=20&result=normal&sort=score&idxname=Rhelp02a&idxname=fun ctions&idxname=docs"


Similarly when I do RSiteSearch("{logistic regression}") qstring is qs2 equal to

"http://search.r-project.org/cgi-bin/namazu.cgi?query={logistic +regression} &max=20&result=normal&sort=score&idxname=Rhelp02a&idxname=functions&idxn ame=docs"

        i.e. the same except for the braces.

        If I do browseURL(qs1) outside of RSiteSearch() it works as expected.
        If I do browseURL(qs2) I get the error.

        Inside browseURL I find that it calls

system(paste(browser, remoteCmd, "> /dev/null 2>&1 ||", browser, quotedUrl, "&"))

and browser is "/usr/bin/open", remoteCmd is the qstring with the opening and closing quote marks attached (escaped with a ``\'') amd quotedUrl is the same. This is true
        irrespective of which qstring (qs1 or qs2 is used).

Note that the double backslash shows up in remoteCmd == quotedUrl at this stage.

Finally I put the system command into a file ``junk'' and from the command window
        (outside R) executed ``sh junk''.

With the braces around ``logistic regression'' I can the same error message that I got in R. When I simply edited out the braces, the Firefox window opened at the appropriate URL. So the problem is in those braces and the single/double
        backslash at the start was a red herring.

Finally, while I was doing all this I got Henrik Bengtsson's message, and tried
        his suggestion:

        library(R.utils)
        browseURL(toUrl(qs2))

        and BINGO!!! that worked.  (Thanks very much, Henrik.)

It's still mysterious why the braces have their deleterious impact on my Mac but do not have that impact on Professor Ripley's machine. (But that's the
        story of my life:  THEY always pick on ***me***! :-) )

So my problem is solved --- via a workaround --- but there's still some vestigial
        strangeness.

        Thanks to all who helped me, especially (again) to Henrik Bengtsson

                cheers,

                        Rolf

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to