Convert a matrix to a 1 dimensional array

后端 未结 10 1503
忘了有多久
忘了有多久 2020-11-27 14:45

I have a matrix (32X48).

How can I convert the matrix into a single dimensional array?

10条回答
  •  借酒劲吻你
    2020-11-27 15:16

    From ?matrix: "A matrix is the special case of a two-dimensional 'array'." You can simply change the dimensions of the matrix/array.

    Elts_int <- as.matrix(tmp_int)  # read.table returns a data.frame as Brandon noted
    dim(Elts_int) <- (maxrow_int*maxcol_int,1)
    

提交回复
热议问题