Intellipaat Back

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

I am using the R version of 3.6.1 GUI 1.70 El Capitan build (7684) in Mac os. And I tried to write a function:

myfunction <- founction(x) {

     y <- rnorm(100)

     mean(y)

}

Then I copy and paste the above command on the console, though I got the result: mean, I also noticed two errors about "{":

myfunction <- founction(x) {

>Error: unexpected '{' in "myfunction <- founction(x) {"    

y <- rnorm(100)

mean(y)

[1] 0.0758422

}

Error: unexpected '}' in "}"

Could someone give me some advice? 

1 Answer

0 votes
by (107k points)

In your code, there is a typo mistake, you should write function() just remove the letter o:

myfunction <- function(x) {

If you are interested in learning R then do check out the  R programming course that will help you out in learning R from scratch.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...