I am using the R programming language.
Suppose I defined 3 functions within the environment :
#function 1
function_1 <- function(x1, x2) {
var_1 <- sin(x1 + x2)
var_2 <- cos(x1 - x2)
goal_1 = sum(var_1 + var_2)
return(goal_1)
}
#function 2
function_2 <- function(x1, x2) {
var_1 <- sin(x1 + x2)
var_2 <- cos(x1 - x2)
goal_1 = sum(var_1 - var_2)
return(goal_1)
}
#function 3
function_3 <- function(x1, x2) {
var_1 <- sin(x1 + x2)
var_2 <- cos(x1 - x2)
goal_1 = sum(var_1 * var_2)
return(goal_1)
}
I found this stackoverflow post (Save all functions in an txt file) which shows how to take all functions within the environment and save them as an "rds" fileL
#save everything within the environment as a "rds" file:
dump(lsf.str(), file="essay_4_code.R")
But is there anything which can directly save these functions as a txt/notepad file? I know that I can just open this file ("essay_4_code.R") in R, then copy/paste all the text into a notepad file, and then save the notepad file - but is there anything which would allow me to do this directly?
Thanks