rray_full_like()
creates an array with the same type and size as x
, but
filled with value
.
rray_ones_like()
is rray_full_like()
with value = 1
.
rray_zeros_like()
is rray_full_like()
with value = 0
.
rray_full_like(x, value) rray_ones_like(x) rray_zeros_like(x)
x | A vector, matrix, array or rray. |
---|---|
value | A value coercible to the same inner type as |
An object with the same type as x
, but filled with value
.
No dimension names will be on the result.
#> <rray<int>[,2][5]> #> [,1] [,2] #> [1,] 1 1 #> [2,] 1 1 #> [3,] 1 1 #> [4,] 1 1 #> [5,] 1 1# `fill` is coerced to `x` if it can be rray_full_like(x, FALSE)#> <rray<int>[,2][5]> #> [,1] [,2] #> [1,] 0 0 #> [2,] 0 0 #> [3,] 0 0 #> [4,] 0 0 #> [5,] 0 0# `value = 1` rray_ones_like(x)#> <rray<int>[,2][5]> #> [,1] [,2] #> [1,] 1 1 #> [2,] 1 1 #> [3,] 1 1 #> [4,] 1 1 #> [5,] 1 1#> [1] TRUE TRUE# `value = 0` rray_zeros_like(x)#> <rray<int>[,2][5]> #> [,1] [,2] #> [1,] 0 0 #> [2,] 0 0 #> [3,] 0 0 #> [4,] 0 0 #> [5,] 0 0