[R]
volkswirt@gmx.net
volkswirt at gmx.net
Mon Mar 31 16:41:48 CEST 2003
How can I remove all rows/collumns from a matrix that fulfill a certain
condition? For instance: remove all negative elements from a [n,1]-matrix.
I intended to write a function for this aim, but it does not work. Despite
that it may help to get my point, when I ad it:
kratek<-function(eine)
{
halt<-0
for(index in 1:dim(eine)[1])
{
if(eine[(index-halt),1]<=0)
{
eine<-eine[-(index-halt),]
halt<-halt+1
}
}
eine
}
Thank You in advance!
More information about the R-help
mailing list