Learning language scratch R (D) - "array (the Array)" Data Structure

This article first to know almost Column: https://zhuanlan.zhihu.com/p/60141207

Also simultaneously updated on my personal blog: https://www.cnblogs.com/nickwu/p/12567789.html


4. [D +]: Array (the Array)

R language can be seen as an array of spreading matrix, the matrix will be extended to more than two dimensions. If a given array is the equivalent of a one-dimensional vector corresponds to the two-dimensional matrix. R array element type is a single language can be a number, logical, or a plurality of character type. Use language array R

4.1 Creating arrays

语法:array(data = NA, dim = length(data), dimnames = NULL)

is an element of the array data, dim is the dimension of the array, dimnames label is the dimension

A <- Array (1: 24, Dim C = (4,3,2)) 
# outputs: 
 ,, 1 
  [1] [2] [3] 
 [1] 159 
 [2] 2 6 10 
 [3] 3711 
 [4] 4812 
 ,, 2 
  [1] [2] [3] 
 [1] 131 721 
 [2] 141 822 
 [3] 15 19 23 
 [4] 16 20 24

Guess you like

Origin www.cnblogs.com/nickwu/p/12567789.html