Arguments
- db
A database connection to an m-Path Sense database.
- sensor
The name of a sensor. See sensors for a list of available sensors.
- participant_id
A character string identifying a single participant. Use
get_participantsto retrieve all participants from the database. Leave empty to get data for all participants.- start_date
Optional search window specifying date where to begin search. Must be convertible to date using as.Date. Use first_date to find the date of the first entry for a participant.
- end_date
Optional search window specifying date where to end search. Must be convertible to date using as.Date. Use last_date to find the date of the last entry for a participant.
Value
A lazy tbl containing the requested data.
Details
Note that this function returns a lazy (also called remote) tibble. This means that
the data is not actually in R until you call a function that pulls the data from the database.
This is useful for various functions in this package that work with a lazy tibble, for example
identify_gaps(). You may manually want to modify this lazy tibble by using dplyr
functions such as dplyr::filter() or dplyr::mutate() before pulling the data into R. These
functions will be executed in-database, and will therefore be much faster than having to first
pull all data into R and then possibly removing a large part of it. Importantly, data can
pulled into R using dplyr::collect().
Examples
if (FALSE) { # \dontrun{
# Open a database
db <- open_db()
# Retrieve some data
get_data(db, "Accelerometer", "12345")
# Or within a specific window
get_data(db, "Accelerometer", "12345", "2021-01-01", "2021-01-05")
} # }
