Skip to content

Instantly share code, notes, and snippets.

@huberflores
Forked from mollietaylor/file.R
Created November 9, 2015 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save huberflores/c2d5aa500bc964e789b7 to your computer and use it in GitHub Desktop.
Save huberflores/c2d5aa500bc964e789b7 to your computer and use it in GitHub Desktop.
Storing a Function in a Separate File in R
# 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)
# defining the function
mult <- function(x, y) {
x*y
}
# 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