Welcome to RStudio IDE - Environment and History!
As you see here, the top right quadrant of
RStudio IDE contains the Environment and History
tabs.
The Environment tab contains a list of all
the variables you have used in your R code.
So when we set x is equal to 1 in the console,
the variable "X" and its current value,
displays in this tab.
This is a good way to quickly see and keep
track of all the variables you've defined.
Note that the "sc" environment variable
is for Apache Spark, which is pre-installed
for you.
If you don't need it or want to remove it,
you can do so from the environment using the
command rm, as in rm(sc) within parentheses
Another interesting feature within RStudio
IDE is that in includes built-in datasets,
which, in R, are called a data frame.
An example of such a data set is "mtcars"
which contains data on the latest motor trends.
So if you were to type mtcars in the R Editor
and run it.
The output would display in tabular form,
as shown here in the console.
There are other built-in datasets, and you
can run the data command with a set of empty
parentheses () to see the full list.
For example, you can type in the first one,
AirPassengers, and run it to see the contents.
Now let's look at what's available and
what's displayed on these two tabs, and
how to navigate in them.
If you want to save all the variables in your
R environment, you can click on the save button
to save your workspace to disk, as an R data
file.
This way, if you load the R data file, it
will load all of your saved variables and
dataframes back into R.
You can also import your own datasets by clicking
on "Import Dataset".
The Import dataset allows you to load files
from your local drive, or from a web URL.
And the last icon allows you to delete all
objects from the current environment.
Doing this is useful if you want to clean
up your environment and start from an empty
workspace again.
However, please be careful and use discretion
with this action because it cannot be undone.
The Global Environments dropdown allows you
to look at all the packages that are currently
loaded in your environment.
When you click on the History tab, you'll
be able to see all the code that you've
executed "but only in this session" (either
from the Console or from the source location
of the data).
You can double click on an entry to paste
it into Console.
This ends the video on Environment and History.
We encourage you to take some time to practice
what you've learned, as well as doing the
Lab.
Thanks for watching!
