Running R files in RStudio doesn't work

What am I doing wrong here? This code works fine in the R console but not in the R IDE.

I don't know what you mean by R IDE but the top panel is just a script file, you need to execute the code for it to take effect (Ctrl+Enter executes only the current line) otherwise is like just writing text.

Cmd+shift+enter executes the whole file.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

Ah, I see. How do I execute the entire file?
Edit: Nevermind, I highlighted my entire file and pressed cmd-enter and it worked. Thanks for helping!