Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201945

Add vector to array in R

$
0
0

I have an array

width.ndvi <- 51
height.ndvi <- 51
totalframes <- 4464
ndvi.array <- array(0, dim = c(height.ndvi, width.ndvi, totalframes))

giving [1:51, 1:51, 1:4464] as the structure of the array. I would like to bind a vector

channel <- rep(1, 4464)

to ndvi.array as the last dimension of the array, so the result has the format

[1:51, 1:51, 1:4464, 1:4464]

However, I may only need an array of [1:51, 1:51, 1:4464, 1], not entirely sure. The final dimension should always have a value of 1, it specifies that the 51x51 image is greyscale, not RBG where the channel value could be between 1 to 3.


Viewing all articles
Browse latest Browse all 201945

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>