RStudio cannot do basic math ?

Hi all, I am completely new to RStudio, transition from SPSS to Rstudio.

I have watched many YouTube videos and tried by myself for hours to get RStudio to print the answer to 2+2 = 4, but I failed.

I know this might be a silly question, but can anyone help me with this error?

You need to run the code. You can do this a few ways

  1. Press the run button (this is a bit above and to the right of where you currently typed your code in the same panel)
  2. Go to the line you want to run and type "ctrl+enter" (Windows) or "command+return" (Mac)
  3. Highlight the code you want to run type "ctrl+enter" (Windows) or "command+return" (Mac)
  4. Type code directly in the console - this is where yours says "R 4.3.2" at the top
2 Likes

OMG, thank you so much, I tried for hours by just simply pressing enter (return) on MAC and it doesn work. Thank you for help.

In addition,

Your screen of R-Studio has 4 parts.
Left - Up is where you handle with scripts and other file formats - this file needs to be run as @StatSteph wisely answered.

Left - Down is console and background jobs. In the console any code you enter automatically runs.

image

Right - Up - usually shows environment data (variables, etc.)

Right - Down - usually shows plots and help.

You can change any of those by choosing: view --> panes --> panes layout

3 Likes

There are a number of ways to learn how to use R and RStudio. May I suggest that you check this free course out:

2 Likes

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.