>From ?cbind For 'cbind' ('rbind') the column (row) names are taken from the names of the arguments, or where those are not supplied by deparsing the expressions given (if that gives a sensible name). The names will depend on whether data frames are included: see the examples.
and you cbind-ed a data frame with columns y, x to a data frame with column x. It seems to me that what S-PLUS does is equally inconsistent: abc <- data.frame(y=1:4, x=rnorm(4)) d <- data.frame(x=1:4, e=5:8) > cbind(abc, d) y x x e ... > cbind(abc, d=d) y x d.x d.e ... > cbind(abc, d=d[1]) y x d ... > cbind(abc, d[1]) y x x ... and I would have expected the third to give the name d.x, not d and not x. Differences from S-PLUS (and please learn to write that correctly!) are not per se bugs in R. On Sat, 31 Jan 2004 [EMAIL PROTECTED] wrote: > 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 > > ______________________________________________ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-devel > > -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-devel