s-news
[Top] [All Lists]

[no subject]

How about:

my.fun<-function(data){all(data<0)}

test<-apply(eg.df,2,my.fun)  

#careful df is an splus function


>eg.df<-matrix(c(-1,1,-1,1),4,4,byrow=T)

> eg.df
     [,1] [,2] [,3] [,4] 
[1,]   -1    1   -1    1
[2,]   -1    1   -1    1
[3,]   -1    1   -1    1
[4,]   -1    1   -1    1

> my.fun<-function(data){all(data<0)}

> test<-apply(eg.df,2,my.fun)  

> test

[1] T F T F
 
-------------------------------------------------------------
Stephen J. Smith
************************************************************

<Prev in Thread] Current Thread [Next in Thread>
  • [no subject], Unknown <=