R resources for getting started

Helpful videos

Importing Data

You can use RStudio to “Import Dataset” in the upper-right panel.  You can import data from Excel or in .csv format.  Often, you will simply download data from MyStatLab and import the Excel file.  Be careful to check or uncleck “First Row as Names” as appropriate.  If the first row is not used as names, R will assign default names.  You may also select names for data that you import.  

Alternatively, you can also write and run the command to import data, for example:

> HW1_7 <- read_excel("~/Downloads/data-12-22-2016-10-57 PM.xlsx", col_names=F)

If you write the command yourself, take note of the following:

Calculations

You can use R to do calculations with this data such as sum the values.

> sum(HW1_7$X0)

 R can be used as your calculator simply by typing expressions.  At the prompt, we enter the expression that we want evaluated and when we hit enter, it will compute the result for us. For Example:

> 4+6

Use * for multiply.
Use ^ for raised to the power of.
Use parentheses to ensure that it understands what you are trying to compute.