[Rd] proposal to allow just transcript files (output only) in the 'tests' directory
Bill Dunlap
bill at insightful.com
Tue Feb 20 20:56:17 CET 2007
On Tue, 20 Feb 2007, Tony Plate wrote:
> Currently, as far as I can see, both input and output fles must be
> supplied in the 'tests' directory (the input in a '.R' file, and the
> output in a corresponding '.Rout.save' file.) Often, the '.R' file is
> redundant, as it could be reconstructed by simply stripping the commands
> out of the '.Rout.save' file. E.g., the command
> $ sed -n -e 's/^[>+] //p' ./src/library/stats/tests/nls.Rout.save
> produces the same R commands as in ./src/library/stats/tests/nls.R
Some output lines start with "+ ". E.g., in
gamlss/tests/manual.Rout.save
I see
> mod3<-stepAIC(mod1, scope=list(lower=~1,upper=~(x1+x2+x3+x4+x5+x6)^2))
Distribution parameter: mu
Start: AIC= 319.16
y ~ x1 + x2 + x3 + x4 + x5 + x6
Df AIC
+ x4:x5 1 307.07
+ x1:x5 1 316.94
- x6 1 317.16
so R would try to parse "x4:x5 1 307.07".
You could use awk so the "^+ " lines had to immediately
follow "^> " (or a properly preceded "^+ "), but I suspect
there will still be problems.
I have experimented with similar things to compare Splus
and R output for the same commands. Having the original
input lines helps there. The hard part is parsing the output
so it can be recognized as a matrix, a vector with names,
an expression, lm() output, etc. Then I could see that
the following outputs are equivalent:
R :
R : Call:
R : lm(formula = log(x) ~ x, data = list(x = 1:10))
R :
R : Coefficients:
R : (Intercept) x
R : 0.2432 0.2304
R :
Splus: Call:
Splus: lm(formula = log(x) ~ x, data = list(x = 1:10))
Splus:
Splus: Coefficients:
Splus: (Intercept) x
Splus: 0.2432038 0.2304068
Splus:
Splus: Degrees of freedom: 10 total; 8 residual
Splus: Residual standard error: 0.2388027
This would also be handy for comparing results in different versions of
R, where low level printing routines may be changed a bit.
----------------------------------------------------------------------------
Bill Dunlap
Insightful Corporation
bill at insightful dot com
360-428-8146
"All statements in this message represent the opinions of the author and do
not necessarily reflect Insightful Corporation policy or position."
More information about the R-devel
mailing list