r - ifelse() returning single value on TRUE test instead of arg 1 -


maybe i'm misunderstanding way ifelse supposed work... have few tables (but longer):

        lean turned turn attempts  [1,]   11      1             2  [2,]   16      2             2  [3,]   41      2             2  [4,]   38      2             2  [5,]   17      2             2  [6,]   43      4             4 

one called x , unsorted 1 called l1llwhole equal x, sorted "lean" column by

 l1llwhole <-x[order(x[,1]),] 

now i'm making list called goforl1 subset of list turn attempts 2 or 4. check make sure @ least 1 2 or 4 first or error.

 ifelse(any((x[order(x[,1]),3]==2) | (x[order(x[,1]),3]==4)),          l1llwhole[(x[order(x[,1]),3]==2) |           (x[order(x[,1]),3]==4),],0)->goforl1 

now strange part when test evaluates true, , argument 1 evaluates table, result of entire statement "11"

isn't ifelse supposed return exact argument as-is?


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -