Nils
Nils

Reputation: 173

How to use the output of function 1 in function2 in R?

I need to call the output from function1 in function2 for estimating purposes.

x=function(param)
{
 z=param^2
}

y=function(param1)
{
 q=z
 zz=q*3
}

How to define z in fonction x to be able to call z later in function y?

Upvotes: 0

Views: 49

Answers (1)

Marion H.
Marion H.

Reputation: 61

You just need to call function x in y :

x <- function(param1){param1^2}  
y <- function(param2){x(param2)*3}

Upvotes: 2

Related Questions