Dear all,
I have come across some Windows Script code which calls the
"file.exists" function in R to check for the existence of a particular
file on an R server. This is what the code looks like:
do
{
// some useful code
}
while (m_workspace.session.eval("file.exists(" + dataFile
+ ")") != "1");
It appears that the behavior of this code is different when used with
R version 2.1.1 compared to R version 1.9.1. If the compare statement
s is changed from
while (s != "1")
to
while (s != "True")
or
while !(s)
the behavior of the code is the same with both versions of R.
After reading the R documentation, I have not found any evidence that
the original syntax (s != "1") is in any way recommended or supported
(in version 2.1.1). Still, my questions are:
1. Is it possible that the syntax has been supported in older versions of R?
2. Is the reason for the recent change in behavior known and
documented anywhere?
I have been unable to find an answer to either question, so any
information about this would be appreciated.
Thanks,
T. Andersson
Change in behavior of compare statement
7 messages · Tomas Andersson, Duncan Murdoch, Mihai Nica +2 more
On 9/19/2005 12:25 PM, Tomas Andersson wrote:
Dear all,
I have come across some Windows Script code which calls the
"file.exists" function in R to check for the existence of a particular
file on an R server. This is what the code looks like:
do
{
// some useful code
}
while (m_workspace.session.eval("file.exists(" + dataFile
+ ")") != "1");
What is this function m_workspace.session.eval? It's not a base function. Perhaps its definition has changed?
It appears that the behavior of this code is different when used with
R version 2.1.1 compared to R version 1.9.1. If the compare statement
s is changed from
while (s != "1")
to
while (s != "True")
or
while !(s)
the behavior of the code is the same with both versions of R.
After reading the R documentation, I have not found any evidence that
the original syntax (s != "1") is in any way recommended or supported
(in version 2.1.1). Still, my questions are:
s != "1" is perfectly valid R code. It will evaluate to TRUE in at least the following case: as.character(s) is not an NA, but isn't "1". s != "True" will evaluate to TRUE in most cases, unless s happens to contain that exact string.
1. Is it possible that the syntax has been supported in older versions of R? 2. Is the reason for the recent change in behavior known and documented anywhere?
The syntax is fine, but it looks like a behaviour change in that function m_workspace.session.eval. You'll need to ask the author of that function what is happening. Duncan Murdoch
On 9/19/2005 1:40 PM, Duncan Murdoch wrote:
On 9/19/2005 12:25 PM, Tomas Andersson wrote:
Dear all,
I have come across some Windows Script code which calls the
"file.exists" function in R to check for the existence of a particular
file on an R server. This is what the code looks like:
do
{
// some useful code
}
while (m_workspace.session.eval("file.exists(" + dataFile
+ ")") != "1");
What is this function m_workspace.session.eval? It's not a base function. Perhaps its definition has changed?
This has to be one of the most out-to-lunch answers I ever wrote. Sorry, please ignore it. The code above is "Windows Script", whatever that is, not R. file.exists hasn't changed, but whatever interface you're using to R presumably has. In the code you're looking at there, it converted TRUE to "1", and now it doesn't. Duncan Murdoch
It appears that the behavior of this code is different when used with
R version 2.1.1 compared to R version 1.9.1. If the compare statement
s is changed from
while (s != "1")
to
while (s != "True")
or
while !(s)
the behavior of the code is the same with both versions of R.
After reading the R documentation, I have not found any evidence that
the original syntax (s != "1") is in any way recommended or supported
(in version 2.1.1). Still, my questions are:
s != "1" is perfectly valid R code. It will evaluate to TRUE in at least the following case: as.character(s) is not an NA, but isn't "1". s != "True" will evaluate to TRUE in most cases, unless s happens to contain that exact string.
1. Is it possible that the syntax has been supported in older versions of R? 2. Is the reason for the recent change in behavior known and documented anywhere?
The syntax is fine, but it looks like a behaviour change in that function m_workspace.session.eval. You'll need to ask the author of that function what is happening. Duncan Murdoch
Greetings, Please help me remember the name of the "tiny" text editor that works with R.... TinR maybe? I cannot find it at all, and cannot remember it, it is really frustrating... Thanks, Mihai Nica, ABD Jackson State University 170 East Griffith Street G5 Jackson, MS 39201 601 914 0361
Dear Mihai, It's Tinn-R (with two n's), at <http://www.sciviews.org/Tinn-R/>. John -------------------------------- John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox --------------------------------
-----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Mihai Nica Sent: Monday, September 19, 2005 4:07 PM To: r-help at stat.math.ethz.ch Subject: Re: [R] text editor TinR? Greetings, Please help me remember the name of the "tiny" text editor that works with R.... TinR maybe? I cannot find it at all, and cannot remember it, it is really frustrating... Thanks, Mihai Nica, ABD Jackson State University 170 East Griffith Street G5 Jackson, MS 39201 601 914 0361
"Mihai Nica" <m_nica at hotmail.com> writes:
Greetings, Please help me remember the name of the "tiny" text editor that works with R.... TinR maybe? I cannot find it at all, and cannot remember it, it is really frustrating...
http://www.sciviews.org/Tinn-R/
O__ ---- Peter Dalgaard ??ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
Thanks to everybody answering my call for help. It is Tinn-R! Mihai Nica, ABD Jackson State University 170 East Griffith Street G5 Jackson, MS 39201 601 914 0361