You probably need to look up on how to write functions.

Try

 scal.fn <- function(P, R, T){
  out <- ( 1/R - T ) / ( P - T )
  return(out)
 }

Here is a fake example:

 df <- cbind.data.frame( P=rnorm(10), R=rnorm(10), T=rnorm(10) )
 scal.fn( df$P, df$R, df$T )

Or are you trying to solve other parameters given scal values? If so, try having a look at functions like uniroot().

Regards, Adai


On 16/08/2010 11:48, Petar Milin wrote:
Hello!
I need to find a simple scalar value:
Scal = ((1/R) - T) / (P - T),
where R, T, and P are vectors in a data.frame.

Please, can anyone tell me how to solve that in R?

Best,
PM

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to