Quick Start with Rstudio

OPTIONAL: If you’ve worked with Rstudio before.

Let’s have a quick look at the Rstudio IDE. It will help you to navigate the IDE faster.

To remember

  • Each piece of code in R is saved with a .R extension and is called a SCRIPT.

  • Comments in a R script start with the “#” symbol.

  • The prompt in the console starts with the “>” symbol.

  • Each package that you need for a script should first be installed and then loaded using the library command.

  • Installation of packages are done only once, however loading of packages are done for every session.

  • IF YOUR SESSION RESTARTS, LOAD ALL YOUR PACKAGES ONCE AGAIN!! (using the library(NameOfPkg) command)

  • Clear the console: Ctrl+L

  • Clear the workspace: rm(list = ls())

  • Code Editor- The place to write your scripts and for viewing data structures using the View command. It contains buttons for running the entire script or for running it line-by-line.

  • R Console- You will use it view the output and for executing single-line commands.

  • Workspace and History- You will find each variable that you created under the “Workspace” tab and a history of all your commands under the “History” tab.

  • Plots and Files- Your one stop for viewing files/plots/installing packages etc.

FUN: Type “Hello <<Your Name>>” in the RConsole. (Don’t forget the quotes).When the greetings are over, proceed to the next section.

results matching ""

    No results matching ""