Introduction to R: The Rstudio IDE
Erin
2017-04-04
Rstudio
Review questions.
Let’s now take some time to really poke around at Rstudio as a program.
- Scripts and tables
- Enviroment and History
- Console
- Plots, Packages, Help, Files..etc
Top Left
You’ve been typing your code in an R script.
- Anytime you’re using R you should be writing code in script form!
- You can save and share the code!
- There are a few other ways to write R scripts, that may be useful in the future. (Such as Rmarkdown, R notebooks, or making slides.)
Top Right
- The variables that you name, show up in the Environment section on the RIGHT. Try clicking on one of the variables with a BLUE ARROW. What did you see?
- You can also look at your History if you’ve lost a command or variable that you want back. It’s searchable to make finding that missing command super easy!
Bottom Right
- Working Directory: Files in the working directory, you can change your working directory to anything else in the code or by going to that location and clicking More -> Set as Directory.
- Plots: Any plots that you produce be in the “Plots” tab. It will keep a history so you can see changes as you make them.
- Packages: You can download new packages by clicking Packages -> Install. You can load packages by checking them off, but this is best done in your scripts!
- Help: Have a question on syntax of a command? You can look at it’s help page by searching for it. You can also poke around tutorials and FAQ.
Some Tips and Tricks
- Use tab complete: Press “tab” after typing the first few letters to find the function, variable, or file that you need without having to type it all in.
- Highlight Strings: You can highlight what you want to put quotes around at once.
- Short Cuts: Hightlight what you want to run and press CNT-ENTER to run it.
- Alt-Shit-K will bring up all the possible shortcuts. Once you get the hang of them, you can start creating your own.