Skip to Main Content

To access Safari eBooks,

ContinueClose

R Studio guide

Lauching the R Program

 

Launching R and RStudio on your computer is simple!

In this guide we discuss manipulating and analyzing data in RStudio. On a Windows computer, find the RStudio icon (shown below), by searching or browsing through your folders, then double click to open the program.

Look for the icon in your computer below!

 

Program Conventions

A ".R" file is a file that allows you to rite code that will run procedures and/or commands to analyze or manipulate data.

Opening a blank .R file can be done on the main window of RStudio. To start, open RStudio on your computer and in the upper left corner of the window click on "File" --> "New File"--> "R Script"  to begin writing code. You may also type 'control+shift+N'.  

 

Opening an .R file image

To save a .R file, click on the floppy disk icon highlighted in the red circle.

 

undefined

We can think of a .R file as a ‘live’ word document, where we write commands that tell RStudio what to do with our data from descriptive statistics to regression models.

RStudio code is written with commands which are the main function or analysis you want RStudio to do in a line of code.

By starting a line with a “ # “, we can write notes and comments that will appear green. RStudio does not recognize this as code.

 

#Frequency of language
table(SLID$language)

 

You can also write blocks of text that do not appear as code by also starting the text with a " # ".

Blocking off code

###DATASET INFORMATION###
#The information will appear in the "help" section when using RStudio
help(SLID)#this code will help us find more information about the data

 

To run code, that is to tell RStudio what you want to do, highlight the code you want to run and click on the 'Run' button highlighted in red below. You can also type "Alt+Enter" on a widows keyboard.

 

undefined