Displaying 20 results from an estimated 2000 matches similar to: "Naming difference in cbind between S-Plus (PR#6515)"
2004 Feb 01
0
Naming difference in cbind between (PR#6516)
I see valid reasons and will therefore adopt the defensive coding practice:
abc <- cbind(abc, d=abc$y - predict.lm(abc.lm, type="terms")[,1])
which works the same in both S-Plus and R and gives the answer I want.
The result of predict.lm is not a data.frame.
It is a "structure" in S-Plus and a "matrix" in R.
S-Plus gives
> M <- matrix(1:4, 2, 2,
2012 Jul 10
1
cbind and cbind.data.frame
## Hi, I'm having trouble understanding how the cbind function decides what
method to apply to its arguments. Easy cut and paste code below.
>
>
>
> ## create two columns
> c1 <- c("A","A","B","B")
> c2 <- 1:4
>
> ## cbind outputs a matrix with elements that are characters, seems
reasonable
> out <-
2007 Jun 21
1
what is "better" when combining data frames? merge vs. rbind & cbind
I often need to "combine" data frames, sometimes "vertically" and other times "horizontally".
When it "better" to use merge? When is it better to use rbind or cbind?
Are there clear pros and cons of each approach?
---------------------------------
[[alternative HTML version deleted]]
2011 Aug 10
1
rbind/cbind
Dear list,
I wonder if there a better way to have rbind/cbind/append to create
the first element (if it is empty) instead of doing the following in a
loop?
for (i in 1:10) {
if (i == 1) {
aRow = SomeExpression(i)
} else {
aRow = rbind(aRow,SomeExpression(i))
}
}
Thanks
Anthony
2013 Jul 23
1
cbind error with check.names
Here is an example where?cbind?fails with an error when?check.names=TRUE?is set.
data(airquality)
airQualityBind =cbind(airquality,airquality,check.names =TRUE)
?I understand that?cbind?is a call to?data.frame?and the following works:
airQualityBind =data.frame(airquality,airquality,check.names =TRUE)
but I would like to understand why?cbind?throws an error.
I asked this question on SO here:
2010 Aug 21
3
cbind
Is there a way to rename the columns to something like A and B in the cbind function?
x <- rnorm(n = 10, mean = 0, sd = 1)
y <- rnorm(n = 10, mean = 0, sd = 1)
cbind(x,y)
1999 Aug 06
0
cbind is not generic as claimed, omits labels where S has them (PR#241)
On Fri, 6 Aug 1999 ihaka@stat.auckland.ac.nz wrote:
> On Fri, Aug 06, 1999 at 12:08:05AM +0200, Peter Dalgaard BSA wrote:
> > Ross Ihaka <ihaka@stat.auckland.ac.nz> writes:
> >
> > I played around with this earlier today. There's nothing special about
> > dataframes, S does the same with any classed object. I.e.
> >
> >
2000 Apr 03
1
cbind.ts(),ts.union() (PR#508)
Full_Name: Wolfgang Koller
Version: 1.0.0
OS: linux
Submission from: (NULL) (137.208.7.48)
> data(UKLungDeaths)
> ts.union(mdeaths, fdeaths,dframe=TRUE)
Error in names<-.default(*tmp*, value = nmsers) :
names attribute must be the same length as the vector
> cbind(mdeaths, fdeaths,dframe=TRUE)
Error in names<-.default(*tmp*, value = nmsers) :
names attribute
2001 Jun 07
1
cbind.data.frame(.) S/R incompatibility
In S-plus (5.1),
> cbind(data.frame(x=1,y=2), data.frame(x=4,u=3))
x y x1 u
1 1 2 4 3
whereas in R, the 3rd name is "x", the same as the 1st one.
I think R should behave the same as S+5.1..
Martin Maechler <maechler@stat.math.ethz.ch> http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum LEO D10 Leonhardstr. 27
ETH (Federal Inst. Technology) 8092 Zurich
2003 Feb 11
1
cbind rises floating point exception (PR#2541)
> x <- matrix(1:10, ncol = 2)
> xc <- cor(x[, 2], x[, 0])
> cbind(xc, vector())
Process R floating point exception at Tue Feb 11 19:16:51 2003
> version
_
platform i686-pc-linux-gnu
arch i686
os linux-gnu
system i686, linux-gnu
status
major 1
minor 6.2
year
2003 Dec 09
1
Maybe some bug on sapply and cbind (PR#5628)
Full_Name: Drouilhet R?my
Version: 1.8.1
OS: Linux
Submission from: (NULL) (195.221.43.136)
Hi!!!
Is there some mistake?
This is some part of one of my R programs. I created this function to show you
the trouble!!!
bugTest<-function() {
paramnames <- c("mean","sd")
param <- list(expression(1),expression(2))
paramtmp <- list(mean=0,sd=1)
if(length(param))
2006 Sep 27
1
S3 methods for cbind/rbind
I created a type of object similar to a data frame. In some circumstances, It
needs special methods for "[" and "[<-" and rbind() (but not cbind()). Then I
found this in the cbind()/rbind() man page:
The method dispatching is _not_ done via 'UseMethod()', but by
C-internal dispatching. Therefore, there is no need for, e.g.,
'rbind.default'.
2008 Apr 23
1
cbind speed.
cbind/ rbind/ data.frame functions are very convenient for merging
vectors of different types into a single data frame, but take quite a
bit of time to execute on larger data sets.
Is it possible to speed these up a bit?
What functions do you use instead?
Thanks & regards,
Charles
2009 Jan 19
1
Floating point excepting when cbind()ing a matrix of grobs (or environments) with a 0-column matrix
library(grid)
e <- rectGrob()
# OR:
# e <- environment()
a <- matrix(list(e), ncol = 1, nrow = 2)
b <- matrix(ncol = 0, nrow = 2)
cbind(a, b)
cbind(a, b)
This reliably crashes R for me.
I realise this is a rather esoteric error condition, but it crops up
for me when creating matrices of grobs to be turned into a ggplot2
plot.
Hadley
--
http://had.co.nz/
2010 Feb 09
1
cbind(deparse.level=2,...) problems
Should the deparse.level=2 argument to cbind
and rbind be abandoned? It is minimally documented,
not used in any CRAN package, and causes some problems.
E.g.,
(a) If a matrix input has row names but not column names
cbind(deparse.level=2,...) stops.
>
m<-matrix(11:14,nrow=2,ncol=2,dimnames=list(Row=c("R1","R2"),Col=charact
er()))
> cbind(m, 101:102,
2017 Dec 22
0
Unexpected dimnames attribute returned by cbind/rbind
Hi,
> m5 <- cbind(integer(5), integer(5))
> m5
[,1] [,2]
[1,] 0 0
[2,] 0 0
[3,] 0 0
[4,] 0 0
[5,] 0 0
> dimnames(m5)
NULL
No dimnames, as expected.
> m0 <- cbind(integer(0), integer(0))
> m0
[,1] [,2]
> dimnames(m0)
[[1]]
NULL
[[2]]
NULL
Unexpected dimnames attribute!
2020 Aug 22
0
M[cbind()] <- assignment with Matrix object loses attributes
Hi Ben,
I had some problems reproducing this.
As far as I can tell *all* indexed assignments drop attributes.
(Maybe we have different versions).
I'm not an expert on S4, but I'm unenthusiastic about mixing slot (S4)
semantics with attribute (S3) semantics.
And str() excludes attributes, but attributes() includes slots.
Highlighting the problems here...
I think R should generate an
2020 Aug 22
1
M[cbind()] <- assignment with Matrix object loses attributes
Thanks for taking a look!
Hmm, really? In `R Under development (unstable) (2020-08-14
r79020)`, doing the indexed assignment with a regular matrix (as opposed
to a Matrix) appears to preserve attributes.
m1 <- matrix(1:9,3,3)
attr(m1,"junk") <- 12
stopifnot(isTRUE(attr(m1,"junk")==12)) ## OK
m1[cbind(1:2,2:3)] <- 1
2003 May 30
1
cbind order
Hello
I need to use this command:
cbind(ftable(xtabs(cnt~geo+slp+con+hey,data=dt3))
hey is in count of success /failure value
but cbind gives failure/success counts. I want to change the order of
this cbind as success /failure counts.
for instance:
I want cbind to give counts as 32-4552 rather than 4552-32
what should I do ?
thanks in advance
Ahmet
TURKEY
2003 Oct 16
1
Cbind warning message
Hello!
I'm not grasping why cbind (in the code below) warns that
Warning message:
number of rows of result
is not a multiple of vector length (arg 2) in: cbind(z, p)
when I do
sections <- function(length, parts)
{
p <- 1:parts
q <- length %/% parts
z <- array(p, dim=c(parts,q))
r <- length %% parts
if ( r > 0 )
{
p[r+1:length(p)] <- NA
z <-