Created
January 7, 2013 03:45
-
-
Save mollietaylor/4472146 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 | |
} |
i have a seperate file in package which stores a function when i used a source in inlcude in another file file of same package it is not working and give me an error on travis ???
anyone please help me out?
thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks you very much cristal clear!