[R] plot of computed vector

hadley wickham h.wickham at gmail.com
Sun Mar 25 15:53:14 CEST 2007


> I apologize for the non-programming language. I found what seems to be a
> strange behavior of plot(). The code follows:
>
> #_____________________________
> N=3030; gn=.04; tn=1:100
> n=N/(1+(N-1)*exp(-gn*tn))
> N=n*(1-exp(-gn*tn))/(1-n*exp(-gn*tn))
> plot(N) #strange plot
>
> N

Have a look at diff(N) to see what's going on.

The default axis labels and printing display too few decimal places to
see the differences between the numbers.

Hadley



More information about the R-help mailing list