[R] Help on a simple function.

Ronaldo Reis Jr. chrysopa at insecta.ufv.br
Fri Feb 21 19:30:09 CET 2003


Hi,

I try to make a function that have two others functions inside.

It is simple, but the problem is that functions inside use the same variable, 
but with different values. I try something like this:

Teste <- function(Pdig(nlinhas),Ldig(nlinhas)) {

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)));
}

print(Pdig)
print(Ldig)
print(Pdig+Ldig)
}

It dont work.

How to make this?

Thanks
Ronaldo

-- 
If at first you don't succeed, quit; don't be a nut about success.
--
|   // | \\   [*****************************][*******************]
|| ( õ   õ )  [Ronaldo Reis Júnior          ][PentiumIII-600     ]
|      V      [UFV/DBA-Entomologia          ][HD: 30 + 10 Gb     ]
||  /     \   [36571-000 Viçosa - MG        ][RAM: 128 Mb        ]
|  /(.''`.)\  [Fone: 31-3899-2532           ][Video: SiS620-8Mb  ]
||/(: :'  :)\ [chrysopa at insecta.ufv.br      ][Modem: Pctel-onboar]
|/ (`. `'` ) \[ICQ#: 5692561                ][Kernel: 2.4.18     ]
||  ( `-  )   [*****************************][*******************]
||| _/   \_Powered by GNU/Debian W/Sarge D+ || Lxuser#: 205366




More information about the R-help mailing list