Editing Statistics and Statistical Programming (Winter 2017)/R lecture outline: Week 3

From CommunityData
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
== Review of material from class ==
* problems folks ran into:
 
** loading data:
* loading data:
*** load() versus read.csv()
** load() versus read.csv()
*** when things don't coopreate...
** when things don't coopreate...
*** library(foreign)  
** library(foreign)  
* other things that have come up
* defining functions
** dates with POSIXct(). dates will almost always be given to you as characters, and you need to parse them
** syntax for defining functions: show the my.mean function
** ordered() — really just a type of factor for ordinal data
** calling functions (your own or others) with apply(), lapply(), sapply()
* new things that are going to be very useful
** defining functions
** merge()
* looping
** apply(), lapply(), sapply()
** for looping
* stuff related to distributions
* stuff related to distributions
** rep()
** rep()
** seq()
** seq()
** sample(); and sampling into data.frames
** sample()
 
** distribution functions: lets focus on *unif(): the key is on page 222 of Verzani
== Online only ==
*** The “d” functions return the p.d.f. of the distribution
 
**** dunif(x=1, min=0, max=3) # 1/3 of the area is the to the left 1
* dates with POSIXct(). dates will almost always be given to you as characters, and you need to parse them
*** The “p” functions return the c.d.f. of the distribution.
* tapply(), and putting things back into data.frames
**** dunif(q=2, min=0, max=3) #1/(b-a) is 2/3
* merge()
*** The “q” functions return the quantiles.
**** qunif(p=0.5, min=0, max=3) # half way between 0 and 3
*** The “r” functions return random samples from a distribution.
**** runif(n=1, min=0, max=3) # a random value in [0,3]
Please note that all contributions to CommunityData are considered to be released under the Attribution-Share Alike 3.0 Unported (see CommunityData:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel Editing help (opens in new window)