[R] Help on a simple function.
Thomas W Blackwell
tblackw at umich.edu
Fri Feb 21 21:33:06 CET 2003
Make it three separate functions. This gives an example
of how argument passing works.
> Pdig <- function(nlinhas) {
> Tdig <- (15.50 + 7.45*nlinhas);
> (3*(Tdig*(30/3600))+1*(30*(30/3600)));
> }
> Ldig <- function(nlinhas) {
> Tdig <- (30.50 + 7.45*nlinhas);
> (2*(Tdig*(30/3600))+1*(30*(30/3600)));
> }
> Teste <- function(nlinhas) {
> print(Pdig(nlinhas))
> print(Ldig(nlinhas))
> print(Pdig(nlinhas) + Ldig(nlinhas))
> }
> Teste(17)
- tom blackwell - u michigan medical school - ann arbor -
More information about the R-help
mailing list