Laura Quinn wrote:
x=1:2881
my.new.matrix<-matrix(nrow=2881,ncol=20)
for(i in 1:20){
my.new.matrix[[i]]<-approx(x,my.matrix[,i],n=2881)
}
the error message says:
Error: more elements supplied than there are to replace
where am I going wrong??
approx() returns a list with $x and $y components
I'd use [,x] instead of [[i]] to replace columns.
Hence:
for(i in 1:20){
my.new.matrix[,i]<-approx(x,my.matrix[,i],n=2881)$y
}
Baz
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html