Hi,

Having a matrix F(189,6575) I want to do this:

z1<-subset(F[,1], F[,1] >= 5 & F[,1] <= 10)
.
.
.
z189<-subset(F[,189], F[,189] >= 5 & F[,189] <= 10)

I would prefer to have an empty matrix, say 'z' in order to fill its 
columns with the output of subsetting F. But each of the subsets can 
differ in length. It's to say:

length(z1)
1189

length(z2)
1238

Don't know how to set up this with a for loop or the use of apply:

z<-189
for (i in 1:189)
{z[i]<-subset(F.zoo[,i], F.zoo[,i] >= 5 & z1 <= 10)}

Error in z[i] <- subset(F.zoo[, i], F.zoo[, i] >= 5 & z1 <= 10) :
        nothing to replace with

or

z<-matrix(0,6575,189)
for (i in 1:189)
{z[i]<-subset(F.zoo[,i], F.zoo[,i] >= 5 & z1 <= 10)}

new error


Thanks,

Antonio

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to