How to call a result from a function in another one in R -
can please tell me how can call output 2 matrices input function?
x1=function(y,z) { output1=y*z output2=y/z } x2=function(p,q) { input=x1(y,z) input1=input$output1 ??? how specify output can call way? output1 , output2 matrices! input2=input$output2 equation=input1+input2 }
i tried return()
, data.frame
both didn't work. tipps?
you can't use c
might otherwise expect because you'll lose structure of matrices. instead, use list
when want return multiple objects r function.
x1 <- function(y,z) { list( output1=y*z, output2=y/z ) }
Comments
Post a Comment