ECON 6306 Lecture Notes - Lecture 2: Scatter Plot, Rstudio

31 views2 pages
Installing and Working with R
There are two versions of R that can be installed. Originally, R was distributed under CRAN but recently Microsoft also
releases R under the MRAN repository. Downloading from MRAN has the advantage of somewhat faster processing in
functions where matrix algebra is involved through multi core processing. It is suggested to download it from MRAN,
install it and then install R-Studio for a nice graphical interface.
When you open R-Studio, press ctrl-shift- ad you’ll get the folloig sree. 1 is here you’ll rite all your ode ad
scripts. You can save this file anywhere and anytime. 2 is where the output and error/warning messages will be shown. 3
is your environment where all of your datasets or values are shown. You can use any of the data appearing here in your
ode. 4 has a fe helpful tas. files gies you aess to all files o your oputer. plots ta shos ay harts or
graphis you ake. Help ta gies iforatio aout ay futio or pakage he you press f1. Pakages shos
the libraries that are available to install and/or load.
Basic functions
These snippets are meant to be written in the script file. Any line starting with # is not interpreted as code. It is called
commenting out the code
install.packages("AER") #will install a package named AER
library(AER) #will load the package into your current session so you can use any functions in the library
my.pi <- 3.14 # will save a variable my.pi equals to 3.14 in your workspace. <- is the assignment operator in R. You can
also use = for assignment but most people use <-. If you type my.pi in a new line and press ctrl+enter, it will give you the
value of my.pi in the output. Ctrl+ enter is the shortcut for running one line of code or a selection of code. If you want to
run your entire code, you can press ctrl+ shift+enter
ls() # will give all datasets or values currently in your workspace
rm(my.pi) # will remove my.pi
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in

Document Summary

There are two versions of r that can be installed. Originally, r was distributed under cran but recently microsoft also releases r under the mran repository. Downloading from mran has the advantage of somewhat faster processing in functions where matrix algebra is involved through multi core processing. It is suggested to download it from mran, install it and then install r-studio for a nice graphical interface. When you open r-studio, press ctrl-shift-(cid:374) a(cid:374)d you"ll get the follo(cid:449)i(cid:374)g s(cid:272)ree(cid:374). 1 is (cid:449)here you"ll (cid:449)rite all your (cid:272)ode a(cid:374)d scripts. You can save this file anywhere and anytime. 2 is where the output and error/warning messages will be shown. 3 is your environment where all of your datasets or values are shown. You can use any of the data appearing here in your (cid:272)ode. These snippets are meant to be written in the script file. Any line starting with # is not interpreted as code.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents