I'm new to R programming, I tried this simple function:
myfunction <- function(y){
y <- rnorm(100)
mean(y)
}
myfunction()
[1] 0.05248908
dir()
[1] "myfunction.R"
source("myfunction.R")
I get the following error:
Error in source("myfunction.R") : myfunction.R:2:3: unexpected symbol 1: 2: R version