Re: [R] constant function

2012-03-07 Thread Eik Vettorazzi
Hi Chris, how about this: constant<-function(x) rep(7,length(x)) curve(constant,-1000,100) cheers. Am 07.03.2012 06:41, schrieb Chris Waggoner: > Is it possible to define a constant function (for example the zero function) > in R? > > I found the following unsatisfying hack to create the "seve

[R] constant function

2012-03-06 Thread Chris Waggoner
Is it possible to define a constant function (for example the zero function) in R? I found the following unsatisfying hack to create the "seven function": constant <- stepfun( x = -100:100, y = rep(7, 201) ) This is mathematically unsatisfying because the domain is artificially restricte