如何修复 UseMethod("filter") 中的错误?它仍然是平均线

问题描述

summary(Bird_Data1)
temp<-scan("Bird_Data1.txt")
year<-seq(from=2002,by=1.0/6,length=length(temp))
plot(year,temp,type="l",xlab="year",ylab="monthly winter temperature",col="blue",pch="*")
d<-6
half.d<-d/2
our.filter<-c(0.5,rep(1,d-1),0.5)/d
our.filter
n<-length(temp)
longer.temp<-c(temp[(d/2):1],temp[n:(n-d/2+1)])
longer.temp
temp.MA<-filter(longer.temp,our.filter)[(d/2+1):(d/2+n)]
temp.MA
plot(year,ylab="monthly winter tempature")
lines(year,temp.MA,lwd=2,pch="*")`

#what is the problem of bold one? it stated"[\[][1]Error in UseMethod("filter") : 
  no applicable method for 'filter' applied to an object of class "c('double','numeric')""]

#我要生成10年以上温度的中心加权移动平均值 出现了一些问题 enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)