Introduction to R Programming

Get to know R and Download

R packages

An R package contain several or bunch of functions and datasets developed by the community, which you can use download it and directly use it by calling their specific function name or dataset name. 

How to install an R package?

install.packages("packagename")

After download it successfully, type the following line:

library(packagename)

If you are confused about what does this package do, use help(package = " "), and what does the function apply for, use help(functionname) of type "?" in front of the function name or package name, the "Help" window will show the R Documentation description for the package or the function.

 

 

Import and Export Data

For importing the Excel .xlsx or .xls file, download the package 'readxl' and call the read_excel function.

For importing the Stata(.dta), SPSS(.sav), SAS(.xport) files, download the package 'haven' and call the function read_dta for Stata, read_spss for Spss, and read_xpt for SAS, respectively.

Marriott Library Eccles Library Quinney Law Library