X-Git-Url: https://git.auder.net/?p=valse.git;a=blobdiff_plain;f=R%2Fvec_bin.R;h=ece7280c78dc5aadd26ebee4343a9755623822c9;hp=01dbfe160da07e2b89941499d0473fd755c892ea;hb=e166ed4e1370aa7961f0d8609936591cfc6808cc;hpb=0b216f854a21821f9be375d07c2932b31e227e78 diff --git a/R/vec_bin.R b/R/vec_bin.R index 01dbfe1..ece7280 100644 --- a/R/vec_bin.R +++ b/R/vec_bin.R @@ -6,18 +6,18 @@ #' @return a list with Z (a binary vector of size the size of X) and indices where Z is equal to 1 vec_bin = function(X,r) { - Z = rep(0,length(X)) - indice = c() - j = 1 - for (i in 1:length(X)) - { - if(X[i] == r) - { - Z[i] = 1 - indice[j] = i - j=j+1 - } else - Z[i] = 0 - } - return (list(Z=Z,indice=indice)) + Z = rep(0,length(X)) + indice = c() + j = 1 + for (i in 1:length(X)) + { + if(X[i] == r) + { + Z[i] = 1 + indice[j] = i + j=j+1 + } else + Z[i] = 0 + } + return (list(Z=Z,indice=indice)) } \ No newline at end of file