Hello. I've observed some odd behaviour. Most likely, it is already known and explained somewhere, but I can't find an explanation anywhere, so I would appreciate being pointed in the right direction.
The issue with the following code is self explanatory: > mat <- matrix(c(c(1,1,1),c(2,2,2)),nrow=3) > mat[,c(1:3%/%2)] [,1] [,2] [1,] 1 1 [2,] 1 1 [3,] 1 1 > n <- 3%/%2 > mat[,c(1:n)] [1] 1 1 1 What I want to know is, why does it give the first column twice when 3%/%2 is computed within the subset call, and just the first row when it is computed outside? Thanks very much in advance. -- View this message in context: http://r.789695.n4.nabble.com/Odd-subsetting-behaviour-tp2279957p2279957.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.