Reputation: 1440
Is there an eqivalent of a fortran subroutine in R?. I have a script that I wish to run parsing a number of different variables (file names, plot limits and so on). At the moment I make a copy and reset these in each new copy which is a bit tedious. It would be nicer to call the script somehow and parse the variables each time like I can do in Fortran.
Upvotes: 1
Views: 1617
Reputation: 2319
You can use functions:
myProd <- function(x,y) {
return(x*y)
}
z <- myProd(3,5)
z
[1] 15
Upvotes: 2