I was surprised by:

 > test <- matrix( as.character(1:4), 2)
 > test
      [,1] [,2]
[1,] "1"  "3"
[2,] "2"  "4"
 > apply(test, 1, paste, sep="+")
      [,1] [,2]
[1,] "1"  "2"
[2,] "3"  "4"
 > apply(test, 1, paste, sep="*")
      [,1] [,2]
[1,] "1"  "2"
[2,] "3"  "4"
 > te <- matrix(1:4, 2)
 > te
      [,1] [,2]
[1,]    1    3
[2,]    2    4
 > apply(te, 1, sum)
[1] 4 6

Why doesn't paste behave in apply as sum?

Kjetil


-- 

Checked by AVG Free Edition.

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to