From rmh at temple.edu  Sat Jan 31 22:27:21 2004
From: rmh at temple.edu (rmh@temple.edu)
Date: Sat Jan 31 22:27:37 2004
Subject: [Rd] Naming difference in cbind between S-Plus (PR#6515)
Message-ID: <20040131212721.4F225F1B2@slim.kubism.ku.dk>

Naming difference in cbind between S-Plus and R.
I think R is wrong.

abc <- data.frame(y=1:4, x=rnorm(4))
abc.lm <- lm(y ~ x, data=abc)
predict.lm(abc.lm, type="terms")  ## this is where R got the name "x"
abc <- cbind(abc, d=abc$y - predict.lm(abc.lm, type="terms"))
abc


R gives
> abc
  y           x        x
1 1 -1.33925477 1.163001
2 2  1.52764505 1.799073
3 3  0.07805628 2.983086
4 4 -0.48720310 4.054840

S-Plus gives
> abc
  y          x        d 
1 1  1.8843692 2.075596
2 2 -0.9144517 1.296060
3 3  0.5063175 3.199408
4 4 -0.7054668 3.428936


Rich

--please do not edit the information below--

Version:
 platform = i386-pc-mingw32
 arch = i386
 os = mingw32
 system = i386, mingw32
 status = 
 major = 1
 minor = 7.1
 year = 2003
 month = 06
 day = 16
 language = R

Windows XP Home Edition (build 2600) Service Pack 1.0

Search Path:
 .GlobalEnv, package:methods, package:ctest, package:mva, package:modreg, package:nls, package:ts, 
file:c:/HOME/rmh/hh/splus.library/.RData, package:grid, package:lattice, Autoloads, package:base


[Rd] Naming difference in cbind between S-Plus (PR#6515)
rmh@temple.edu