[R] Help to make a function

Uwe Ligges ligges at statistik.uni-dortmund.de
Wed Jan 29 13:29:56 CET 2003


Ronaldo Reis Jr. wrote:
> Hi all,
> 
> I have a simple code to produce some populations graphics.
> 
> 10: DIM X(71)
> 20: INPUT "r=";R
> 30: INPUT "k=";K
> 40: INPUT "P(0)=";P(0)
> 50: FOR T=0 TO 69
> 60: P(T+1) = P(T) + R*P(T) * (1-P(T)/K)
> 70: NEXT T
> 80: GRAPH
> 90: COLOR 0
> 100: LINE (0,0)-(0,220)
> 110: LINE (0,0)-(220,0)
> 120: LINE (0,K)-(220,K)
> 130: COLOR 3
> 140: FOR T= 0 TO 69
> 150: LINE (3*T,P(T)-(3*(T+1)),P(T+1))
> 160: NEXT T
> 170: COLOR 0
> 180: END
> 
> where P = Y, T = X, R and K are constants.
> 
> how to make a similar function in R to make this graphic?

By porting that Basic code? The details are left as an exercise for the 
reader, since you stated it is "simple".

Uwe Ligges




More information about the R-help mailing list