[R] matrix propagation problem

2013-12-29 Thread Gregory Carey
Please see the code and R output below. I cannot understand why a matrix object 
is being propagated in row major order by default and then in column major 
order when byrow=TRUE is specified when I use one set of dimensions. But when I 
use different dimensions, the propagation is correct.
Greg

> pvec <- colMeans(rbind(hapn, hapn2))
> class(pvec)
[1] "numeric"
> length(pvec)
[1] 100
> pvec[1:5]
[1] 0.08263811 0.59034639 0.21173734 0.77819000 0.11360578
> nLoci
[1] 100
> nObs
[1] 500
> pvecMat <- matrix(pvec, nLoci, nObs)
> pvecMat[1:5, 1:7]
   [,1]   [,2]   [,3]   [,4]   [,5]   [,6]   
[,7]
[1,] 0.08263811 0.08263811 0.08263811 0.08263811 0.08263811 0.08263811 
0.08263811
[2,] 0.59034639 0.59034639 0.59034639 0.59034639 0.59034639 0.59034639 
0.59034639
[3,] 0.21173734 0.21173734 0.21173734 0.21173734 0.21173734 0.21173734 
0.21173734
[4,] 0.77819000 0.77819000 0.77819000 0.77819000 0.77819000 0.77819000 
0.77819000
[5,] 0.11360578 0.11360578 0.11360578 0.11360578 0.11360578 0.11360578 
0.11360578
> pvecMat2 <- matrix(pvec, nLoci, nObs, byrow=TRUE)
> pvecMat2[1:5, 1:7]
   [,1]  [,2]  [,3][,4]  [,5] [,6] [,7]
[1,] 0.08263811 0.5903464 0.2117373 0.77819 0.1136058 0.149802 0.829995
[2,] 0.08263811 0.5903464 0.2117373 0.77819 0.1136058 0.149802 0.829995
[3,] 0.08263811 0.5903464 0.2117373 0.77819 0.1136058 0.149802 0.829995
[4,] 0.08263811 0.5903464 0.2117373 0.77819 0.1136058 0.149802 0.829995
[5,] 0.08263811 0.5903464 0.2117373 0.77819 0.1136058 0.149802 0.829995
> matrix(pvec, 2, 5)
   [,1]  [,2]  [,3]  [,4]  [,5]
[1,] 0.08263811 0.2117373 0.1136058 0.8299950 0.7709431
[2,] 0.59034639 0.7781900 0.1498020 0.6973011 0.3875476
__
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.


[R] suppress GUI window when loading a library

2011-03-16 Thread Gregory Carey
When some libraries (e.g., VIM and Rcmdr) are loaded, they automatically 
display a GUI window. Is there a way to load the library but suppress the 
window?
greg

gregory carey
university of colorado

__
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.