weighted - 如何修复 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,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,temp,type="l",xlab="year",ylab="monthly winter tempature")
lines(year,temp.MA,type="l",lwd=2,col="blue",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年以上温度的中心加权移动平均值出现一些问题 在此处输入图像描述
解决方案
推荐阅读
- javascript - 显示在 jQuery UI Datepicker 中突出显示的最小和最大日期
- jquery - scrollTop 在 iframe 中时不起作用
- c# - 如何以编程方式将任务添加到特定的 Outlook 存储
- julia - Julia:抽象类型的覆盖函数没有被调用
- django - 如何仅使用社交媒体身份验证但也仅通过管理员用户邀请对新用户进行身份验证?
- java - 单击项目后如何关闭回收站视图持有者?
- arduino - 无法获得柔性传感器的恒定值
- netlogo - 在 Netogo 上创建游戏 Snake
- python - 为什么我的 Miller-Rabin 算法实现无法检测到某些素数?
- android - 获取文件的访问时间