-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnavigating.qmd
113 lines (63 loc) · 6.84 KB
/
navigating.qmd
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Navigating the R and RStudio interfaces {#sec-navigating}
## Questions
- What are the main components of the R interface?
- How is the RStudio Integrated Development Environment (IDE) organized, and what are its key features?
- How does one navigate the R and RStudio interfaces?
- What are the functions of the various RStudio panes?
## Learning Objectives
- Identify and understand the main components of the R interface.
- Navigate the RStudio IDE and comprehend its organizational structure.
- Customize your RStudio environment to suit your preferences.
- Understand the roles of the console and menu options in the R software.
- Review the various panes and menu options in the RStudio software.
- Learn the various keyboard shortcuts that can improve speed and efficiency.
## Lesson Content
### The R interface
#### Menu options
The R graphical user interface opens up with a console where you can start writing and executing code (@fig-r-console-1). Additionally, there exists a toolbar that contains shortcuts to commonly used functions. The menu bar allows one to perform various operations within the R software. The various menu bar options and a brief summary of their main uses are listed below:
- File: Create new scripts and workspaces, as well as review the session history.
- Edit: Copy, paste, and edit, as well as set up the graphical user interface (GUI) preferences.
- View: Include the toolbar and status bar within the GUI.
- Misc: Control computations and review objects.
- Packages: Install, load, and update packages.
- Windows: Arrange multiple windows in the learner’s preferred orientation.
- Help: Find links to FAQs, manuals, and help functions.
![The R Console](images/navigating/r_console_1.png){#fig-r-console-1}
### RStudio interface (Panes)
When opened for the 1st time, the RStudio interface will have 3 panes: Console, Environment, and Navigation. To include the 4th required panel, click on “File” --\> “New File” --\> “R Script”. Now that the 4 panes are open, let us review the functions of each panel shown below.
![The RStudio Console](images/navigating/rstudio_console_1.png){#fig-rstudio-console-1}
#### Script Pane (Text Editor)
The script pane allows the user to write, edit, and save code. This code can then be run, and the output will be displayed in the console pane.
#### Console Pane
In the console pane, one can write and edit code, but not save. Within the console, one can run one line of code at a time. Additionally, one can access the terminal tab and run code via the command line. Lastly, we can access the “Background Jobs” tab to monitor the progress of R scripts that are running in a separate, dedicated R session.
#### Environment/History Pane
This pane has multiple uses. The “Environment” tab shows the values of objects loaded in the current R session. Additionally, from this tab, one can load workspaces, import datasets, and observe memory usage. The “History” tab allows you to see what has been run previously, and the “Connections” tab provides a method for connecting to various databases. Lastly, the “Tutorial” tab helps with training users on the basic concepts of R.
#### Navigation Pane
The navigation pane allows the user to manage files (create new folders and scripts), view generated plots, and review and update installed packages. Additionally, there is a “Help” tab for basic queries, and “Viewer” and “Presentation” tabs for reviewing analysis outputs.
### RStudio interface (Menu Options)
The RStudio interface has a number of menu bar options shown below (@fig-rstudio-menu-options-1).
![RStudio interface (Menu Options)](images/navigating/rstudio_menu_options_1.png){#fig-rstudio-menu-options-1}
To orient the user, a brief description of each menu bar option has been provided below.
- File: Create new files and projects, save them, as well as open and close the projects. Additionally, importing of datasets is made much easier by the “Import Dataset” option.
- Edit: Using this option, one can cut, copy, and paste, as well as undo and redo any actions.
- Code: Edit code formats and run code.
- View: Change the appearance of the RStudio graphical user interface (GUI), adjust and view different panes.
- Plots: View plots and save the plot outputs to different formats.
- Session: Create sessions, load workspaces, and set the working directories.
- Build: Configure build tools and edit the project options.
- Debug: Debug your code.
- Profile: Helps the user understand how R spends its time, and helps the R user to run the code faster.
- Help: The help section allows one to access tools for troubleshooting. Additionally, it contains documentation and cheatsheets that allow for to discover more about the software.
- Tools: Install packages and check for package updates. Additionally, one can review version control options, access the terminal, and look at keyboard shortcuts. A short snippet of the numerous shortcuts is shown below (@fig-rstudio-ks-1).
![A list of shortcuts available in RStudio](images/navigating/rstudio_ks_1.png){#fig-rstudio-ks-1}
Lastly, one access both “Project Options” and “Global Options” from this menu bar option. Here, the user can change the appearance and pane layout for individual projects and globally.
## Exercises
i. Describe the main components of the RStudio interface.
ii. Open RStudio and explore the different panels of the interface, then provide a brief summary of the purpose of the Environment, History, Files, and Plots panes.
iii. What is the purpose of the Console pane in RStudio?
iv. Access the help documentation using the Help pane and find information on specific R functions/packages.
v. Customize your RStudio environment by changing the theme and adjusting the appearance settings.
vi. Practice using keyboard shortcuts for common tasks in RStudio.
vii. How can you customize the layout of panes in RStudio?
## Summary
This brief overview of the R/RStudio interface should make the learner more comfortable when using the software. In this chapter, we explored the main components of the R interface and delved into the organizational structure of the RStudio IDE. Understanding the different panes and tabs within RStudio is crucial for efficient and effective programming. We navigated through the Source, Console, Environment, Plots, and Help panes, as well as additional tabs for managing files, plots, packages, and the viewer. Customizing your RStudio environment enhances your overall experience, and practicing keyboard shortcuts can significantly improve your coding efficiency. As you proceed with this guide, having a solid grasp of navigating the R and RStudio interfaces will empower you in your journey as an R programmer. Few introductory courses provide this overview, and it is hoped that this will decrease the cognitive load on learners in future lessons.