projects
/
valse.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix indexations: test.EMGLLF without errors (but R <> C)
[valse.git]
/
R
/
vec_bin.R
diff --git
a/R/vec_bin.R
b/R/vec_bin.R
index
01dbfe1
..
27f771b
100644
(file)
--- 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)
{
#' @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))
-}
\ No newline at end of file
+ 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))
+}