do you mean:
f=function(x)
0*(abs(x-.5)<=.3)-1*(abs(x-.5)>=.4)+(10*x-2)*(x>.1&x<.2)+(-10*x+8)*(x>=.2&x<=.5)
f(x)
curve(f,0,1)
hope it helps.
Patrizio
2009/2/14 kathie :
>
> Dear R users,
>
> >From the code below, I try to compute "y" value. (In fact, y looks like a
> trapezoid)
>
>
Dear Kathie,
On Fri, 13 Feb 2009 21:08:25 -0800 (PST)
kathie wrote:
> Dear R users,
> [snip]
>
> However, even though the results show that y=8 for x=0.11, when
> x=0.11, actual y value is -0.9. And, y=-0.8 for x=0.88. I cannot
> understand the above results.
It may help you to understand th
Dear R users,
>From the code below, I try to compute "y" value. (In fact, y looks like a
trapezoid)
--
x <- seq(0,1,.01)
y <- ifelse(abs(x-.5)<=0.3,0,
ifelse(abs(w-.5)>=0.4,-1,
ifelse((0.1 x
[1] 0
3 matches
Mail list logo