Dates and Time + Tables Flashcards
1
Q
Dates and Time Data
A
- Have traits of both character and numeric data.
2
Q
as.Date()
A
- Function that converts character representations of dates (without times).
- Best used with dates that appear without times.
- Can allow for a variety of input formats using the format = argument.
3
Q
strptime()
A
- Function that converts character representations of dates and times to Unix (POSIX).
- Used when data has times, time zones, AM/PM time stamps, etc.
4
Q
Lubridate
A
- Package that makes character representations of dates / times easy to convert.
- Handles the computation of intervals easily.
5
Q
Beginning Data in R
A
- Almost all dates are stored by R as the number of days or seconds from January 1, 1970.
6
Q
unclass(argument)
A
- Function in R that can be used to reveal R’s storage of the date.
7
Q
Formatting of Dates in R
A
- R expects the format of YYYY-MM-DD or YYYY/MM/DD.
8
Q
Format Options for as.Date()
A
1) %B: full month spelled out.
2) %b: abbreviated month spelled out
2) %d: day 1-31.
3) %y: 2 digit year.
4) %Y: 4 digit year.
4) %h: hour in 24 hours.
5) %S: seconds.
6) %I: 12 hour clock.
7) %M: minutes.
8) %p: AM/PM.
9
Q
weekdays(), months(), quarters()
A
- Base R functions that can be used.
- Return character vectors.
10
Q
hours(), minutes()
A
- Functions in lubridate which can be useful for variables with time stamps.
11
Q
table(vector_argument)
A
- Function that create the simplest table.
- Generates a one-way table.
- Can utilize the option levels = to name the columns.
- For example,
offcampus$RDOW
12
Q
table(argument1,argument2)
A
- Function that creates a simple two way table.
- argument1 is for the row variable.
- argument2 is for the column variable.
13
Q
prop.table(argument)
A
- Function that tells R to display proportions for tables.
- Argument requires a table to serve as data.
- All the number sin the table will cum to one.