12: Working with Dates and Times

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/27

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 1:53 AM on 9/18/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

28 Terms

1
New cards

FRONT

BACK

2
New cards

How would you put the 1AD 2nd of January 1am 2 minutes and 3 seconds in ISO 8601 format? (the kind of ISO 8601 R likes)

0001-01-02 01:02:03

3
New cards

How do you create a date object and POSIXct object?

Use the as.Date() and as.POSIXct function

4
New cards

What package and function converts data in many forms into a Date or POSIXct?

anytime

5
New cards

What is the easiest function to use to determine the latest Date in a vector of Dates?

max()

6
New cards

When parsing a frequently used date or datetime order, what lubridate function should you use?

lubridate should have specialized functions for most of these orders

7
New cards

What lubridate function makes a date? What function makes a datetime? What feature makes these functions useful?

make_date()

make_datetime()

These functions are useful because they can take vectors as arguments, which allows for entries from datasets

8
New cards

What lubridate function extracts the year from a date? What is another use for this function?

year()

This function can be used to duplicate a date and then change its year

9
New cards

For the month function, how do you get the months to display as strings instead of numerics?

label = TRUE

10
New cards

What function take a boolean vector, and returns TRUE if one of the datavalues is TRUE?

any()

11
New cards

What are the rounding functions for dates and datetimes? What units can you round to?

floor_date()

ceiling_date ()

round_date()

Any units, including amounts of units (e.g. 5 minutes)

12
New cards

What function gives you the difference between dates?

difftime()

13
New cards

Which lubridate function gives you the current datetime?

now()

14
New cards

What is the difference between periods and durations in lubridate?

Periods are measured in standard timekeeping terms, while durations are measured in seconds

15
New cards

How would you add a period of a day and a duration of a day to a date named x?

x + day(1)

x + dday(1)

16
New cards

How would you create a sequence of periods or durations?

x:x * period(x)

17
New cards

What operators add or subtract months in a manner that fixes overflow? (ex: Jan 31st + 1 month = February NA)

%m+%

%m-%

18
New cards

What operator tells you if a date is within a certain period?

%within%

19
New cards

What function extracts a timezone from a date or datetime?

tz()

20
New cards

What function creates a clone of a time or datetime with the same time but a different time zone?

force_tz()

21
New cards

What function creates a clone of a time or datetime but in a different time zone with the time translated over?

with_tz()

22
New cards

What function returns a list of all timezones?

OlsonNames()

23
New cards

What package revolves around times without dates?

hms

24
New cards

What package parses dates and datetimes quickly?

fasttime

25
New cards

What lubridate function parses dates or datetimes quickly?

fast_strptime

26
New cards

What lubridate function creates a function that formats a date or datetime in your manner of choosing?

stamp()

27
New cards

FIRST PASS

FIRST PASS

28
New cards

SECOND PASS

SECOND PASS