powered by
Make n hot vector.
nHot(x, len, out = "matrix")
[integer] Which features are active?
integer
[integer(1)] Length of the feature vector.
integer(1)
[character(1)] Format of the output. Can be a vector or a matrix.
character(1)
[matrix(1, len)] A one-row matrix with len columns with every entry 0 except the columns specified by x which are 1.
matrix(1, len)
len
x
# NOT RUN { nHot(c(1, 3), 5) nHot(c(1, 3), 5, out = "vector") # }
Run the code above in your browser using DataLab