Thanks to John MacCuish who pointed out
that the batch mode does not handle correctly the if..else structure.
The suggested solution consists of using
successive if statements without else and it actually works.
Michel
-----Original Message-----
From: s-news-owner@lists.biostat.wustl.edu
[mailto:s-news-owner@lists.biostat.wustl.edu] On
Behalf Of Michel Guillet
Sent: Thursday,
August 07, 2003 10:09
To: s-news@lists.biostat.wustl.edu
Subject: [S] Inconsistent behavior
in BATCH mode
Dear all,
I have encountered what seems to me
a very strange behavior of S-Plus batch mode:
I have a script that estimates a
model with the nlsList function, then extracts the parameters and puts them in
a data frame
my.coef <-
as.data.frame(coef(nlsList(…)))
It then tests for the existence of a
given coefficient to impute a value if missing and perform another action
otherwise:
if (is.na(my.coef[1,1])) …
else …
When running this from within
S-Plus, everything works smoothly.
However, when this script is submitted
in batch mode, is.na(my.coef[1,1]) returns a NULL value. I have checked that
my.coef[1,1] actually gets a value in batch mode.
Has anyone an idea on what might be
causing this?
Thanks in advance,
Michel
___________________________________________
Michel Guillet
President
Creascience
1097,
Saint-Alexandre Suite 301
Montreal QC
H2Z
1P8 Canada
Tel:
(514) 840-9220 x26
Web site: www.creascience.com
The Virtual Statistician: www.virtualstatistician.com
Statistical Training: training.creascience.com
___________________________________________