[R] constant function
chris.is.fun at gmail.com
Wed Mar 7 06:41:20 CET 2012
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 restricted to [-100,100] rather than (-Inf,Inf).
Additionally, unless I use pch="n" there are ugly dots on the plot (and again this feels hackish).
Any suggestions on what else to do?
Thanks in advance.
More information about the R-help