Title: | Sensus Analytics |
---|---|
Description: | Provides access and analytic functions for Sensus data. |
Authors: | Matthew S. Gerber |
Maintainer: | Matthew S. Gerber <[email protected]> |
License: | GPL-3 |
Version: | 2.3.1 |
Built: | 2024-11-22 03:51:43 UTC |
Source: | https://github.com/cran/SensusR |
Plot accelerometer data.
## S3 method for class 'AccelerometerDatum' plot(x, pch = ".", type = "l", ...)
## S3 method for class 'AccelerometerDatum' plot(x, pch = ".", type = "l", ...)
x |
Accelerometer data. |
pch |
Plotting character. |
type |
Line type. |
... |
Other plotting parameters. |
None
Plot altitude data.
## S3 method for class 'AltitudeDatum' plot(x, pch = ".", type = "l", ...)
## S3 method for class 'AltitudeDatum' plot(x, pch = ".", type = "l", ...)
x |
Altitude data. |
pch |
Plotting character. |
type |
Line type. |
... |
Other plotting parameters. |
None
Plot battery data.
## S3 method for class 'BatteryDatum' plot(x, pch = ".", type = "l", main = "Battery", ...)
## S3 method for class 'BatteryDatum' plot(x, pch = ".", type = "l", main = "Battery", ...)
x |
Battery data. |
pch |
Plotting character. |
type |
Line type. |
main |
Main title. |
... |
Other plotting parameters. |
None
Plot cell tower data.
## S3 method for class 'CellTowerDatum' plot(x, ...)
## S3 method for class 'CellTowerDatum' plot(x, ...)
x |
Cell tower data. |
... |
Other plotting arguments. |
None
Plot compass data.
## S3 method for class 'CompassDatum' plot(x, pch = ".", type = "l", ...)
## S3 method for class 'CompassDatum' plot(x, pch = ".", type = "l", ...)
x |
Compass data. |
pch |
Plotting character. |
type |
Line type. |
... |
Other plotting parameters. |
None
Plot light data.
## S3 method for class 'LightDatum' plot(x, pch = ".", type = "l", ...)
## S3 method for class 'LightDatum' plot(x, pch = ".", type = "l", ...)
x |
Light data. |
pch |
Plotting character. |
type |
Line type. |
... |
Other plotting parameters. |
None
Plot location data.
## S3 method for class 'LocationDatum' plot(x, ...)
## S3 method for class 'LocationDatum' plot(x, ...)
x |
Location data. |
... |
Arguments to pass to plotting routines. This can include two special arguments: qmap.args (passed to |
None
Plot screen data.
## S3 method for class 'ScreenDatum' plot(x, ...)
## S3 method for class 'ScreenDatum' plot(x, ...)
x |
Screen data. |
... |
Other plotting parameters. |
None
Plot sound data.
## S3 method for class 'SoundDatum' plot(x, pch = ".", type = "l", ...)
## S3 method for class 'SoundDatum' plot(x, pch = ".", type = "l", ...)
x |
Sound data. |
pch |
Plotting character. |
type |
Line type. |
... |
Other plotting parameters. |
None
Plot speed data.
## S3 method for class 'SpeedDatum' plot(x, pch = ".", type = "l", ...)
## S3 method for class 'SpeedDatum' plot(x, pch = ".", type = "l", ...)
x |
Speed data. |
pch |
Plotting character. |
type |
Line type. |
... |
Other plotting parameters. |
None
Plot telephony data.
## S3 method for class 'TelephonyDatum' plot(x, ...)
## S3 method for class 'TelephonyDatum' plot(x, ...)
x |
Telephony data. |
... |
Other plotting parameters. |
None
Plot WLAN data.
## S3 method for class 'WlanDatum' plot(x, ...)
## S3 method for class 'WlanDatum' plot(x, ...)
x |
WLAN data. |
... |
Other plotting parameters. |
None
Decompresses JSON files downloaded from AWS S3.
sensus.decompress.gz.files(local.path, skip = TRUE, overwrite = FALSE, remove = FALSE)
sensus.decompress.gz.files(local.path, skip = TRUE, overwrite = FALSE, remove = FALSE)
local.path |
Path to location on local machine. |
skip |
If TRUE and the output file already exists, the output file is returned as is. |
overwrite |
If TRUE and the output file already exists, the file is silently overwritten; otherwise an exception is thrown (unless skip is TRUE). |
remove |
If TRUE, the input file is removed afterward, otherwise not. |
None
Decrypts Sensus .bin files that were encrypted using asymmetric public/private key encryption.
sensus.decrypt.bin.files(data.path, is.directory = TRUE, recursive = TRUE, rsa.private.key.path, rsa.private.key.password = askpass, replace.files = FALSE)
sensus.decrypt.bin.files(data.path, is.directory = TRUE, recursive = TRUE, rsa.private.key.path, rsa.private.key.password = askpass, replace.files = FALSE)
data.path |
Path to Sensus .bin data (either a file or a directory). |
is.directory |
Whether or not the path is a directory. |
recursive |
Whether or not to read files recursively from directory indicated by path. |
rsa.private.key.path |
Path to RSA private key generated using OpenSSL. |
rsa.private.key.password |
Password used to decrypt the RSA private key. |
replace.files |
Whether or not to delete .bin files after they have been decrypted. |
None
Get timestamp lags for a Sensus data frame.
sensus.get.all.timestamp.lags(data)
sensus.get.all.timestamp.lags(data)
data |
Data to plot lags for (e.g., the result of |
List of lags organized by datum type.
Get timestamp lags for a Sensus datum.
sensus.get.timestamp.lags(datum)
sensus.get.timestamp.lags(datum)
datum |
Data to plot lags for (e.g., the result of |
List of lags.
Gets unique device IDs within a dataset.
sensus.get.unique.device.ids(data)
sensus.get.unique.device.ids(data)
data |
Data to write, as read using |
Unique device IDs within the data.
Lists activities in a given phase and state.
sensus.list.activities(data, phase = "Starting", state = "Active")
sensus.list.activities(data, phase = "Starting", state = "Active")
data |
Data, as returned by |
phase |
Phase of activity (Starting, During, Stopping) |
state |
State of phase (Active, Inactive, Unknown) |
None
Lists S3 buckets.
sensus.list.aws.s3.buckets(profile = "default", aws.path = "/usr/local/bin/aws")
sensus.list.aws.s3.buckets(profile = "default", aws.path = "/usr/local/bin/aws")
profile |
AWS credentials profile to use for authentication. |
aws.path |
Path to AWS client. |
None
Plot the CDF of inter-reading time lags.
sensus.plot.lag.cdf(datum, xlim = c(0, 1), xlab = "Inter-reading time (seconds)", ylab = "Percentile", main = paste("Inter-reading times (n=", nrow(datum), ")", sep = ""))
sensus.plot.lag.cdf(datum, xlim = c(0, 1), xlab = "Inter-reading time (seconds)", ylab = "Percentile", main = paste("Inter-reading times (n=", nrow(datum), ")", sep = ""))
datum |
Data frame for a single datum. |
xlim |
Limits for the x-axis. |
xlab |
Label for x-axis. |
ylab |
Label for y-axis. |
main |
Label for plot. |
None.
Read JSON-formatted Sensus data.
sensus.read.json.files(data.path, is.directory = TRUE, recursive = TRUE, local.timezone = Sys.timezone(), data.types = NULL)
sensus.read.json.files(data.path, is.directory = TRUE, recursive = TRUE, local.timezone = Sys.timezone(), data.types = NULL)
data.path |
Path to Sensus JSON data (either a file or a directory). |
is.directory |
Whether or not the path is a directory. |
recursive |
Whether or not to read files recursively from directory indicated by path. |
local.timezone |
The local timezone to convert datum timestamps to, or NULL to leave the timestamps unconverted. |
data.types |
Specific data types to read. A full list of data types can be found here: https://predictive-technology-laboratory.github.io/sensus/api/Sensus.Datum.html. For example |
All data, listed by type.
# data.path = system.file("extdata", "example-data", package="SensusR") # data = sensus.read.json.files(data.path)
# data.path = system.file("extdata", "example-data", package="SensusR") # data = sensus.read.json.files(data.path)
Removes all data associated with a device ID from a data collection.
sensus.remove.device.id(datum, device.id)
sensus.remove.device.id(datum, device.id)
datum |
Data collection to process. |
device.id |
Device ID to remove. |
Data without a particular device ID.
Synchronizes data from Amazon S3 to a local path.
sensus.sync.from.aws.s3(s3.path, profile = "default", local.path = tempfile(), aws.path = "/usr/local/bin/aws", delete = FALSE, decompress = FALSE)
sensus.sync.from.aws.s3(s3.path, profile = "default", local.path = tempfile(), aws.path = "/usr/local/bin/aws", delete = FALSE, decompress = FALSE)
s3.path |
Path within S3. This can be a prefix (partial path). |
profile |
AWS credentials profile to use for authentication. |
local.path |
Path to location on local machine. |
aws.path |
Path to AWS client. |
delete |
Whether or not to delete local files that are not present in the S3 path. |
decompress |
Whether or not to decompress any gzip files after downloading them. |
Local path to location of downloaded data.
Write data to CSV files.
sensus.write.csv.files(data, directory, file.name.prefix = "")
sensus.write.csv.files(data, directory, file.name.prefix = "")
data |
Data to write, as read using |
directory |
Directory to write CSV files to. Will be created if it does not exist. |
file.name.prefix |
Prefix to add to the generated file names. |
None
Write data to rdata files.
sensus.write.rdata.files(data, directory, file.name.prefix = "")
sensus.write.rdata.files(data, directory, file.name.prefix = "")
data |
Data to write, as read using |
directory |
Directory to write CSV files to. Will be created if it does not exist. |
file.name.prefix |
Prefix to add to the generated file names. |
None
Provides access and analytic functions for Sensus data. More information can be found at the following URL:
https://predictive-technology-laboratory.github.io/sensus
The SensusR functions handle reading, cleaning, plotting, and otherwise analyzing data collected via the Sensus system.
Trim leading and trailing white space from a string.
trim(x)
trim(x)
x |
String to trim. |
Result of trimming.
Trim leading white space from a string.
trim.leading(x)
trim.leading(x)
x |
String to trim. |
Result of trimming.
Trim trailing white space from a string.
trim.trailing(x)
trim.trailing(x)
x |
String to trim. |
Result of trimming.