Multiline Functions

I am doing something wrong when I try to create a function

I enter

I want to enter "myfunc3 <- variable(a) {" and RSTUDIO automatically creates the "}" on the same line that then it will not let me enter more than one line of code.

There does not appear to be a next line delimiter like , or . or \n

As a result, I can't create a real function

When I use the edit(myfunc3) command, it let's me create a function, but when I click on save, it closes but does not save. Please help. I am new with RSTUDIO and R and without help, I am stuck

If you are entering code in the console, usually that is the lower left pane, you can enter multiple lines using Shift + Enter. I never actually do the; I use the Script pane at the top left for multiline code.

To define a function you should use function() as in the following where I defined a multiline function in the console. The + marks are made automatically, you do not type them in.

> myfunc3 <- function(a) {
+     tmp <- a * 3
+     tmp^3
+ }

Thank you.

I would use the upper left quadrant in the console but it is stuck in read only mode and I can’t find a place to change it.

I am using a new MacBook Pro with the M1 chip and latest version of OS.