Note that there are some explanatory texts on larger screens.

plurals
  1. POmultidimensional array indexing changing values of my matrices
    primarykey
    data
    text
    <p>I've got a multidimensional array with 13,057 8X11 matrices inside it.</p> <pre><code>dim(results) [1] 13057 8 11 </code></pre> <p>Every time I to index a particular matrix, the values inside the matrix change. For example, say I do:</p> <pre><code>head(results) [1] 0.2789366 0.1555067 0.3026808 0.1644631 0.2325074 0.3162973 </code></pre> <p>but when I do </p> <pre><code>results[1,,] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 0.2789366 0.2789366 0.2789366 0.2789366 0.2789366 0.2789366 0.2789366 0.2789366 0.2789366 [2,] 0.1191516 0.1191516 0.1191516 0.1191516 0.1191516 0.1191516 0.1191516 0.1191516 0.1191516 [3,] 0.1805271 0.1805271 0.1805271 0.1805271 0.1805271 0.1805271 0.1805271 0.1805271 0.1805271 [4,] 0.1846702 0.1846702 0.1846702 0.1846702 0.1846702 0.1846702 0.1846702 0.1846702 0.1846702 [5,] 0.4004454 0.4004454 0.4004454 0.4004454 0.4004454 0.4004454 0.4004454 0.4004454 0.4004454 [6,] 0.1336974 0.1336974 0.1336974 0.1336974 0.1336974 0.1336974 0.1336974 0.1336974 0.1336974 [7,] 0.2155045 0.2155045 0.2155045 0.2155045 0.2155045 0.2155045 0.2155045 0.2155045 0.2155045 [8,] 0.5307715 0.5307715 0.5307715 0.5307715 0.5307715 0.5307715 0.5307715 0.5307715 0.5307715 </code></pre> <p>Why are my all of my rows having the same value? This is NOT what the initial value of this matrix was before I put it in the multidimensional array nor is it the value I get when I print all of the matrices in the console. </p> <p>This is my code:</p> <pre><code>range01 &lt;- function(x){(x-min(x))/(max(x)-min(x))} results = array(0,dim=c(13057,8,11)) for( i in 1:13057) { ap &lt;- as.numeric(unlist(ap.dv[i,1:11])) dv &lt;- as.numeric(unlist(ap.dv[i,12:19])) m &lt;- outer(ap, dv, FUN="*") m[is.na(m)] &lt;- 0 m &lt;- range01(m) results[] &lt;- m } </code></pre> <p>thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload