将plot函数重命名为其他名称,例如myplot,就可以了.I'm trying to use a function in order to read in different models. Using the code below without a function works. When I use the function and call it, I will get the error Error: evaluation nested too deeply: infinite recursion / options(expressions=)?Can anyone tell me why?x=rnorm(1000)+sin(c(1:1000)/100)#random data+ sinus superimposedplot <- function(model){ par(mfrow=c(2,2))# plot window settings plot(model) lines(filter(model,rep(1/30,30)),col='red') plot(filter(model,rep(1/30,30))) plot(model-filter(model,rep(1/30,30))) # variances of variable, long term variability and short term variability var(model) var(filter(model, rep(1/30,30)),na.rm=T) var(model-filter(model, rep(1/30,30)),na.rm=T)}plot(x) 解决方案 The problem is that the plot function you are defining is also the one that gets called inside its body, so there is an infinite recursion here.Rename your plot function to something else, like myplot, and you should be fine. 这篇关于错误:评估嵌套太深:无限递归/选项(表达式=)?在R3.3.2中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
11-02 03:32