[R] Function Help

jimdare jamesdare26 at gmail.com
Mon Oct 12 01:11:35 CEST 2009


Hi there,

I have created the function below:

pirate<-function(x){
a<-x-1; b<-a/5; c<-a-b;
d<-c-1; e<-d/5; f<-d-e;
g<-f-1; h<-g/5; i<-g-h;
j<-i-1; k<-j/5; l<-j-k;
m<-l-1; n<-m/5; o<-m-n;
final<-o/5;

final
}

I want to run this function until the output ('final') is an exact integer
(e.g. 893.00000 rather than 893.78332).  I then need to find out what value
of X (input) resulted in this integer.  Could someone please help?  I am
relatively inexperienced at creating functions.

Kind regards,
James 

-- 
View this message in context: http://www.nabble.com/Function-Help-tp25848627p25848627.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list