@@ -97,7 +97,7 @@ compute_time_spent_intern <- function(data, labels) {
97
97
# ' @export
98
98
boxplot.timeSpent <- function (x , col = NULL , ... ) {
99
99
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 )) +
101
101
geom_boxplot(... ) +
102
102
labs(x = " State" , y = " Time Spent" , fill = " State" )
103
103
@@ -189,7 +189,7 @@ hist.duration <- function(x, breaks = NULL, ...) {
189
189
defaultParam <- list (fill = " lightblue" , color = " black" , bins = breaks )
190
190
param <- c(extraParam , defaultParam [which(! (names(defaultParam ) %in% names(extraParam )))])
191
191
192
- ggplot(data.frame (duration = as.vector(x )), aes_string (x = " duration" )) +
192
+ ggplot(data.frame (duration = as.vector(x )), aes (x = .data $ duration )) +
193
193
do.call(geom_histogram , param ) +
194
194
labs(x = " Duration" , y = " Frequency" )
195
195
}
@@ -426,7 +426,7 @@ plot_pt_classic <- function(pt, col = NULL) {
426
426
time = rep(pt $ t , nrow(pt $ pt ))
427
427
)
428
428
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 )) +
430
430
geom_line() +
431
431
ylim(0 , 1 ) +
432
432
labs(x = " Time" , y = " p(t)" , title = " P(X(t) = x)" )
@@ -460,12 +460,14 @@ plot_pt_ribbon <- function(pt, col = NULL, addBorder = TRUE) {
460
460
461
461
p <- ggplot(plot_data )
462
462
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 [[labels [i ]]],
466
+ ymax = .data [[labels [i + 1 ]]],
467
+ x = .data $ time ,
468
+ fill = shortLabels [i ]
469
+ ),
470
+ colour = ifelse(addBorder , " black" , NA ), alpha = 0.8
469
471
)
470
472
}
471
473
@@ -575,7 +577,7 @@ hist.njump <- function(x, breaks = NULL, ...) {
575
577
defaultParam <- list (fill = " lightblue" , color = " black" , bins = breaks , center = 0 )
576
578
param <- c(extraParam , defaultParam [which(! (names(defaultParam ) %in% names(extraParam )))])
577
579
578
- ggplot(data.frame (njump = as.vector(x )), aes_string (x = " njump" )) +
580
+ ggplot(data.frame (njump = as.vector(x )), aes (x = .data $ njump )) +
579
581
do.call(geom_histogram , param ) +
580
582
labs(x = " Number of jumps" , y = " Frequency" ) +
581
583
scale_x_continuous(breaks = function (x ) pretty(seq(ceiling(x [1 ]), floor(x [2 ]), by = 1 )))
0 commit comments