Statistics and Statistical Programming (Spring 2019)/R lecture outline: Week 3: Difference between revisions
From CommunityData
(Created page with "== Review of material from class == * loading data: ** load() versus read.csv() ** when things don't coopreate... ** library(foreign) * defining functions ** syntax for de...") |
|||
Line 2: | Line 2: | ||
* loading data: | * loading data: | ||
** load() versus read.csv() | ** load() versus read.csv() vs. read.delim() (w arguments like row.names=FALSE) | ||
** when things don't | ** when things don't cooperate... | ||
* library(foreign) for datasets from Stata and beyond (check the documentation!) | |||
* defining functions | * defining functions | ||
** syntax for defining functions: show the my.mean function | ** syntax for defining functions: show the my.mean function | ||
** calling functions (your own or others) with apply(), lapply(), sapply() | ** calling functions repeatedly (your own or others) with apply(), lapply(), sapply() | ||
** debugging with print() | |||
** demonstrate w my.mean() | |||
* stuff related to distributions | * stuff related to distributions | ||
Line 15: | Line 16: | ||
** seq() | ** seq() | ||
** sample(); and sampling into data.frames | ** sample(); and sampling into data.frames | ||
== Online only == | == Online only == |
Revision as of 23:36, 4 April 2019
Review of material from class
- loading data:
- load() versus read.csv() vs. read.delim() (w arguments like row.names=FALSE)
- when things don't cooperate...
- library(foreign) for datasets from Stata and beyond (check the documentation!)
- defining functions
- syntax for defining functions: show the my.mean function
- calling functions repeatedly (your own or others) with apply(), lapply(), sapply()
- debugging with print()
- demonstrate w my.mean()
- stuff related to distributions
- rep()
- seq()
- sample(); and sampling into data.frames
Online only
- dates with POSIXct(). dates will almost always be given to you as characters, and you need to parse them
- tapply(), and putting things back into data.frames
- merge()