2017-08-13 16:07:24 +02:00
|
|
|
#' @export
|
2018-05-07 01:09:57 +02:00
|
|
|
plot.osem_measurements = function (x, ..., mar = c(2, 4, 1, 1)) {
|
2023-03-06 11:17:33 +01:00
|
|
|
oldpar <- par(no.readonly = TRUE)
|
|
|
|
on.exit(par(oldpar))
|
2018-01-05 00:13:53 +01:00
|
|
|
par(mar = mar)
|
2017-08-24 13:57:15 +02:00
|
|
|
plot(value~createdAt, x, col = factor(x$sensorId), xlab = NA, ylab = x$unit[1], ...)
|
2017-08-12 15:17:47 +02:00
|
|
|
invisible(x)
|
|
|
|
}
|
2017-08-24 21:19:00 +02:00
|
|
|
|
2018-01-05 00:03:45 +01:00
|
|
|
#' @export
|
|
|
|
print.osem_measurements = function (x, ...) {
|
|
|
|
print.data.frame(x, ...)
|
2018-01-05 00:13:53 +01:00
|
|
|
invisible(x)
|
2018-01-05 00:03:45 +01:00
|
|
|
}
|
|
|
|
|
2017-08-24 21:19:00 +02:00
|
|
|
#' Converts a foreign object to an osem_measurements data.frame.
|
2018-10-19 23:41:56 +02:00
|
|
|
#' @param x A data.frame to attach the class to.
|
|
|
|
#' Should have at least a `value` and `createdAt` column.
|
2023-03-06 11:04:40 +01:00
|
|
|
#' @return data.frame of class \code{osem_measurements}
|
2017-08-24 21:19:00 +02:00
|
|
|
#' @export
|
|
|
|
osem_as_measurements = function(x) {
|
2023-02-02 17:08:40 +01:00
|
|
|
ret = tibble::as_tibble(x)
|
2018-06-07 00:04:50 +02:00
|
|
|
class(ret) = c('osem_measurements', class(ret))
|
2017-08-24 21:19:00 +02:00
|
|
|
ret
|
|
|
|
}
|