-
Notifications
You must be signed in to change notification settings - Fork 0
/
rstudio.Rmd
55 lines (31 loc) · 1.76 KB
/
rstudio.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# What is RStudio (Posit)?
* Free and open source IDE (Integrated Development Environment) for R
* Available for Windows, Mac OS and LINUX
<img src="images/setup_rstudio_icon.png" alt="rstudio logo" width="300"/>
## RStudio interface
* 4 panels:
+ **top-left**: scripts and files
+ **bottom-left**: R console Linux-line terminal / command-line
+ **top-right**: environment, history, connections, tutorial
+ **bottom-right**: tree of folders and files, plots/graphs window, packages, help window, viewer, presentation
<img src="images/rstudio_interface.png" alt="rstudio interface" width="1200"/>
## The R console
The R **console** (bottom-left panel) is where the magic happens!
It is where the user/programmer/you will **interact** with R.
Let's give it a try. Type (or copy-paste) the following in the console (bottom-left panel), and hit the **Enter/Return** key:
<img src="images/rstudio_return_key.png" alt="return key 1" width="60"/>
<img src="images/rstudio_return_key2.jpg" alt="return key 2" width="100"/>
```{r, eval=F}
getwd()
```
**getwd()** is a function. Remember that functions are followed by **parenthesis/round brackets**.
Upon clicking **Enter/Return**, you are asking the R kernel to **execute the function**.
What R returns is the **response/result** after executing the function.
The getwd() function retrieves and outputs your current working directory.
Let's try to interact a bit more with the console: copy-paste the following, and hit Enter/Return:
```{r, eval=F}
7*3
```
R gives you the results of this simple multiplication.
**USEFUL TIP**
In the console, press the **up arrow** key <img src="images/rstudio_up_arrow.png" alt="rstudio interface" width="50"/>: this goes **back to the previous commands/lines** you wrote and sent in the console.