mirror of
https://github.com/msberends/AMR.git
synced 2024-12-25 18:46:11 +01:00
examples edit
This commit is contained in:
parent
46db3f7b13
commit
6c67c8f6c1
16
R/classes.R
16
R/classes.R
@ -28,15 +28,9 @@
|
|||||||
#' rsi_data <- as.rsi(c(rep("S", 474), rep("I", 36), rep("R", 370)))
|
#' rsi_data <- as.rsi(c(rep("S", 474), rep("I", 36), rep("R", 370)))
|
||||||
#' rsi_data <- as.rsi(c(rep("S", 474), rep("I", 36), rep("R", 370), "A", "B", "C"))
|
#' rsi_data <- as.rsi(c(rep("S", 474), rep("I", 36), rep("R", 370), "A", "B", "C"))
|
||||||
#' is.rsi(rsi_data)
|
#' is.rsi(rsi_data)
|
||||||
|
#'
|
||||||
#' plot(rsi_data) # for percentages
|
#' plot(rsi_data) # for percentages
|
||||||
#' barplot(rsi_data) # for frequencies
|
#' barplot(rsi_data) # for frequencies
|
||||||
#'
|
|
||||||
#' \donttest{
|
|
||||||
#' library(dplyr)
|
|
||||||
#' tbl %>%
|
|
||||||
#' mutate_at(vars(ends_with("_rsi")), as.rsi)
|
|
||||||
#' sapply(mic_data, is.rsi)
|
|
||||||
#' }
|
|
||||||
as.rsi <- function(x) {
|
as.rsi <- function(x) {
|
||||||
if (is.rsi(x)) {
|
if (is.rsi(x)) {
|
||||||
x
|
x
|
||||||
@ -201,15 +195,9 @@ barplot.rsi <- function(height, ...) {
|
|||||||
#' @examples
|
#' @examples
|
||||||
#' mic_data <- as.mic(c(">=32", "1.0", "1", "1.00", 8, "<=0.128", "8", "16", "16"))
|
#' mic_data <- as.mic(c(">=32", "1.0", "1", "1.00", 8, "<=0.128", "8", "16", "16"))
|
||||||
#' is.mic(mic_data)
|
#' is.mic(mic_data)
|
||||||
|
#'
|
||||||
#' plot(mic_data)
|
#' plot(mic_data)
|
||||||
#' barplot(mic_data)
|
#' barplot(mic_data)
|
||||||
#'
|
|
||||||
#' \donttest{
|
|
||||||
#' library(dplyr)
|
|
||||||
#' tbl %>%
|
|
||||||
#' mutate_at(vars(ends_with("_mic")), as.mic)
|
|
||||||
#' sapply(mic_data, is.mic)
|
|
||||||
#' }
|
|
||||||
as.mic <- function(x, na.rm = FALSE) {
|
as.mic <- function(x, na.rm = FALSE) {
|
||||||
if (is.mic(x)) {
|
if (is.mic(x)) {
|
||||||
x
|
x
|
||||||
|
@ -23,13 +23,7 @@ This transforms a vector to a new class\code{mic}, which is an ordered factor wi
|
|||||||
\examples{
|
\examples{
|
||||||
mic_data <- as.mic(c(">=32", "1.0", "1", "1.00", 8, "<=0.128", "8", "16", "16"))
|
mic_data <- as.mic(c(">=32", "1.0", "1", "1.00", 8, "<=0.128", "8", "16", "16"))
|
||||||
is.mic(mic_data)
|
is.mic(mic_data)
|
||||||
|
|
||||||
plot(mic_data)
|
plot(mic_data)
|
||||||
barplot(mic_data)
|
barplot(mic_data)
|
||||||
|
|
||||||
\donttest{
|
|
||||||
library(dplyr)
|
|
||||||
tbl \%>\%
|
|
||||||
mutate_at(vars(ends_with("_mic")), as.mic)
|
|
||||||
sapply(mic_data, is.mic)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -22,13 +22,7 @@ This transforms a vector to a new class \code{rsi}, which is an ordered factor w
|
|||||||
rsi_data <- as.rsi(c(rep("S", 474), rep("I", 36), rep("R", 370)))
|
rsi_data <- as.rsi(c(rep("S", 474), rep("I", 36), rep("R", 370)))
|
||||||
rsi_data <- as.rsi(c(rep("S", 474), rep("I", 36), rep("R", 370), "A", "B", "C"))
|
rsi_data <- as.rsi(c(rep("S", 474), rep("I", 36), rep("R", 370), "A", "B", "C"))
|
||||||
is.rsi(rsi_data)
|
is.rsi(rsi_data)
|
||||||
|
|
||||||
plot(rsi_data) # for percentages
|
plot(rsi_data) # for percentages
|
||||||
barplot(rsi_data) # for frequencies
|
barplot(rsi_data) # for frequencies
|
||||||
|
|
||||||
\donttest{
|
|
||||||
library(dplyr)
|
|
||||||
tbl \%>\%
|
|
||||||
mutate_at(vars(ends_with("_rsi")), as.rsi)
|
|
||||||
sapply(mic_data, is.rsi)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user