This function creates a vector using a
as a template
and k
as its value.
Row names are taken from the row names of a
.
The column name is given by colname
.
Row and column types are transferred from a
to the output, directly.
kvec_from_template_byname(a, k = 1, colname = NA, column = TRUE)
a | The template matrix for the column vector. |
---|---|
k | The value of the entries in the vector. |
colname | The name of the output vector's 1-sized dimension
(the only column if |
column | Tells whether a column vector ( |
A vector vector formed from a
.
If column == FALSE
, colname
is interpreted as the row name for the output row identity vector.
kvec_from_template_byname(matrix(42, nrow = 4, ncol = 2, dimnames = list(c("r1", "r2", "r3", "r4"), c("c1", "c2"))), colname = "c1")#> c1 #> r1 1 #> r2 1 #> r3 1 #> r4 1