Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in R Programming by (19k points)

myfunction <- function(y){

     y <- rnorm(100)

     mean(y) 

}

myfunction()

[1] 0.05248908

dir()

[1] "myfunction.R"

source("myfunction.R")

Error in source("myfunction.R") : myfunction.R:2:3: unexpected symbol 1: 2: R version

I just started learning R programming, any help will be appreciated.. thank you

1 Answer

0 votes
by (33.1k points)

You can format your code like this to resolve the error:

myfunction <- function() {

  y <- rnorm(100)

  mean(y)

}

Hope this answer helps you!

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...