@@ -97,7 +97,7 @@ compute_time_spent_intern <- function(data, labels) {
9797# ' @export
9898boxplot.timeSpent <- function (x , col = NULL , ... ) {
9999 df <- data.frame (timeSpent = as.vector(x ), state = factor (rep(colnames(x ), each = nrow(x )), levels = colnames(x )))
100- p <- ggplot(df , aes_string (x = " state" , y = " timeSpent" , fill = " state" )) +
100+ p <- ggplot(df , aes (x = .data $ state , y = .data $ timeSpent , fill = .data $ state )) +
101101 geom_boxplot(... ) +
102102 labs(x = " State" , y = " Time Spent" , fill = " State" )
103103
@@ -189,7 +189,7 @@ hist.duration <- function(x, breaks = NULL, ...) {
189189 defaultParam <- list (fill = " lightblue" , color = " black" , bins = breaks )
190190 param <- c(extraParam , defaultParam [which(! (names(defaultParam ) %in% names(extraParam )))])
191191
192- ggplot(data.frame (duration = as.vector(x )), aes_string (x = " duration" )) +
192+ ggplot(data.frame (duration = as.vector(x )), aes (x = .data $ duration )) +
193193 do.call(geom_histogram , param ) +
194194 labs(x = " Duration" , y = " Frequency" )
195195}
@@ -426,7 +426,7 @@ plot_pt_classic <- function(pt, col = NULL) {
426426 time = rep(pt $ t , nrow(pt $ pt ))
427427 )
428428
429- p <- ggplot(plot_data , aes_string (x = " time" , y = " proba" , group = " State" , colour = " State" )) +
429+ p <- ggplot(plot_data , aes (x = .data $ time , y = .data $ proba , group = .data $ State , colour = .data $ State )) +
430430 geom_line() +
431431 ylim(0 , 1 ) +
432432 labs(x = " Time" , y = " p(t)" , title = " P(X(t) = x)" )
@@ -460,12 +460,14 @@ plot_pt_ribbon <- function(pt, col = NULL, addBorder = TRUE) {
460460
461461 p <- ggplot(plot_data )
462462 for (i in seq_len(nState )) {
463- p <- p + geom_ribbon(aes_string(
464- ymin = paste0(" `" , labels [i ], " `" ),
465- ymax = paste0(" `" , labels [i + 1 ], " `" ), x = " time" ,
466- fill = shortLabels [i ]
467- ),
468- colour = ifelse(addBorder , " black" , NA ), alpha = 0.8
463+ p <- p + geom_ribbon(
464+ aes(
465+ ymin = .data [[paste0(" `" , labels [i ], " `" )]],
466+ ymax = .data [[paste0(" `" , labels [i + 1 ], " `" )]],
467+ x = .data $ time ,
468+ fill = .data [[shortLabels [i ]]]
469+ ),
470+ colour = ifelse(addBorder , " black" , NA ), alpha = 0.8
469471 )
470472 }
471473
@@ -575,7 +577,7 @@ hist.njump <- function(x, breaks = NULL, ...) {
575577 defaultParam <- list (fill = " lightblue" , color = " black" , bins = breaks , center = 0 )
576578 param <- c(extraParam , defaultParam [which(! (names(defaultParam ) %in% names(extraParam )))])
577579
578- ggplot(data.frame (njump = as.vector(x )), aes_string (x = " njump" )) +
580+ ggplot(data.frame (njump = as.vector(x )), aes (x = .data $ njump )) +
579581 do.call(geom_histogram , param ) +
580582 labs(x = " Number of jumps" , y = " Frequency" ) +
581583 scale_x_continuous(breaks = function (x ) pretty(seq(ceiling(x [1 ]), floor(x [2 ]), by = 1 )))
0 commit comments