Rでbox平均。
corcor2<-0 sdsdsd2<-0 IQRIQR3<-0 lenlen3<-0 sdsdsd3<-0 meanmean3<-0 jjj<-flow_volume for(i in 1:length(filelist)){ try(ll<-mat_volume[,i]) try(corcor2[i]<-cor(ll,jjj,use="complete.obs")) try(sdsdsd2[i]<-sd(ll/jjj,na.rm=T)) ll2<-ll ll2[is.na(ll2)]<-0 try(sdsdsd3[i]<-sd(ll2,na.rm=T)) try(meanmean3[i]<-mean(ll2,na.rm=T)) try(IQRIQR3[i]<-IQR(ll/jjj,na.rm=T)) try(lenlen3[i]<- length(ll[!is.na(ll)])) #cat(i,"\n") cat(i,"\n") } wakekijyun<-function(x,y,log=F,len=32,d=-1,func="mean",na.rm=F,zero.rm=F){ #x<-1:100 #y<-0.3*x #d=-1 #len<-32 #func<-"mean" if(na.rm){ xb2<-x[!is.na(x) & !is.na(y)] yb2<-y[!is.na(x) & !is.na(y)] x<-xb2 y<-yb2 } if(log==F){ if(d==-1){ if(zero.rm==T){ d<-seq(min(x[x!=0]),max(x),length.out=len) }else{ d<-seq(min(x),max(x),length.out=len) } } }else{ if(zero.rm==T){ d<-exp(seq(min(log(x[x!=0])),max(log(x)),length.out=len)) }else{ d<-exp(seq(min(log(x)),max(log(x)),length.out=len)) } } st<-d[1:(length(d)-1)] fi<-d[2:length(d)] xx<-0 yy<-0 for(i in 1:length(fi)){ xb<-x[x>=st[i] & x<=fi[i]] yb<-y[x>=st[i] & x<=fi[i]] str<-paste(sep="","yy[i]<-",func,"(yb[yb>0])") str2<-paste(sep="","xx[i]<-",func,"(xb[yb>0])") try(eval(parse(text=str))) try(eval(parse(text=str2))) } data.frame(xx,yy) }