[R] Cbind warning message

Paul Lemmens P.Lemmens at nici.kun.nl
Thu Oct 16 10:46:28 CEST 2003


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 <- cbind(z,p)
	}

	z <- na.omit(as.vector(t(z)))
}

and then

sections(32,5) -> a

As I see it, rows in result are 5 and the vector length of p (which is 5) 
is a multiple of 5.

kind regards,
Paul


-- 
Paul Lemmens
NICI, University of Nijmegen              ASCII Ribbon Campaign /"\
Montessorilaan 3 (B.01.03)                    Against HTML Mail \ /
NL-6525 HR Nijmegen                                              X
The Netherlands                                                 / \
Phonenumber    +31-24-3612648
Fax            +31-24-3616066




More information about the R-help mailing list