Introduction¶
This chapter gives on overview of the book, but also introduces some fundamental concepts, such as objects, variables, and workspaces; saving and loading variables and objects; and Rscripts. Below is the supporting material for the sections of the chapter.
Variables and Objects¶
 Script file:
variables.R

Interactive notebook:
In [1]:options(jupyter.rich_display=FALSE) # Create output as usual in R
In [2]:# Defining two variables a < 1 b < 2 # Entering the name leads to printing the content of the variable a
In [3]:# Showing the variables defined: ls()
In [4]:# Removing variables: rm(a,b) # Checking the existence of a variable exists("a")
In [5]:# Defining and removing "hidden" variables a < 1 b < 2 x < 3 y < 4 z < 42 .zzyx < 1412 ls()
In [6]:rm(list=ls()) ls()
In [7]:ls(all=TRUE)
In [ ]:
Saving and loading Objects¶
 Script file:
savingandloadingobjects.R

Interactive notebook:
In [5]:options(jupyter.rich_display=FALSE) # Create output as usual in R
In [6]:# In this example we create the two variables 'a' and 'b': a < 1 b < 1 # We save them in the data file "ab.RData" save(a,b,file="ab.RData") # We then remove the two variables: rm(a,b) ls()
In [7]:# With then load the data file load("ab.RData") # and verify that the two variables are restored ls()
In [8]:a
In [9]:b
Working with Rscripts¶

Script file:
runningscripts.R
The code run in this script makes use of another script
sourceechodemo.R
which is (also available for download). 
Interactive notebook: