-
-
Save huberflores/c2d5aa500bc964e789b7 to your computer and use it in GitHub Desktop.
Storing a Function in a Separate File in R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# calling the functions | |
# this is the file where we will call the functions in fun.R and times.R | |
times <- dget("times.R") | |
times(-4:4, 2) | |
source("fun.R") | |
mult(-4:4, 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# defining the function | |
mult <- function(x, y) { | |
x*y | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# defining the function | |
function(x, y) { | |
x*y | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment