REditorSupport / REditorSupport/vscode-R

Base R Terminal error on `R: Run from Beginning to Line`

Open
#1,499 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
1.2k
Forks
139
Avg merge
2h 46m
Merged PRs (30d)
5

Description

Describe the bug
Seemingly on MacOS, there are some odd terminal behaviors when NOT using radian where extra characters get added, text is garbled, or text is sent to the terminal in a way that it breaks functionality. This new stackoverflow post brought it up though I have experienced something similar when trying to use the R: Run from Beginning to Line command on longer scripts.

To Reproduce
Steps to reproduce the behavior:

  1. Go to settings.json and ensure the base R term is used for r.rterm.mac and r.rpath.mac.
  2. Set r.bracketedPaste to false
  3. Open R in VS Code and R: Run from Beginning to Line at the bottom of a "longer" script.

I have tried this when "r.bracketedPaste": false and when it is true and code fails to execute properly either way. Interestingly, when I change r.rterm.mac back to using radian R: Run from Beginning to Line works when"r.bracketedPaste": false and when it is true.

As an example here is a function that errors out when I use R: Run from Beginning to Line.

Function
roc_f <- function(mod, response) {
    # generate prediction
    pred <- ROCR::prediction(
        glmmTMB:::predict.glmmTMB(mod, type = "response"),
        mod$frame |> dplyr::pull(response)
    )

    # cut rate ----

    # cut
    cut <- ROCR::performance(
        pred,
        "tpr",
        "tnr"
    )

    # create df
    cut_df <- data.frame(
        x = cut@x.values |> unlist(),
        y = cut@y.values |> unlist(),
        alpha = cut@alpha.values |> unlist()
    )
    colnames(cut_df) <- c(cut@x.name, cut@y.name, cut@alpha.name)
    cut_df <- cut_df |>
        data.table::as.data.table() |>
        data.table::melt.data.table(id.vars = cut@alpha.name)

    cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y = value,
            group = variable
        )
    ) +
        ggplot2::geom_line(
            ggplot2::aes(linetype = variable, color = variable)
        ) +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
        ggplot2::ylab("Sensitivity/Specificity") +
        ggplot2::xlab("Cutpoint") +
        gr.sg::theme_wgfd()

    # auc plot ----

    # get raw auc value
    auc <- ROCR::performance(
        pred,
        measure = "auc"
    ) |>
        getElement("y.values") |>
        unlist()

    # get true positive & false positive
    auc_plot <- ROCR::performance(
        pred,
        "tpr",
        "fpr"
    )

    # turn to df and rename cols
    auc_dat <- data.frame(
        x = auc_plot@x.values,
        y = auc_plot@y.values
    )
    colnames(auc_dat) <- c(auc_plot@x.name, auc_plot@y.name)

    # ggplot2 object
    auc_plot <- ggplot2::ggplot(
        auc_dat,
        ggplot2::aes(
            x = .data[[auc_plot@x.name]],
            y = .data[[auc_plot@y.name]]
        )
    ) +
        ggplot2::geom_line() +
        ggplot2::geom_abline(col = "red") +
        ggplot2::ggtitle(
            label = "ROC curve",
            subtitle = paste0("AUC: ", round(auc, digits = 3))
        ) +
        gr.sg::theme_wgfd()

    # return ----

    # setup list
    ls <- list(
        auc_val = auc,
        auc_plot = auc_plot,
        cut_plot = cut_plot
    )

    # return
    return(ls)
}

This is what happens in my terminal when I try to run it - note that it repeats itself multiple times:

Terminal
# ROC function ----

roc_f <- function(mod, response) {
    # generate prediction
    pred <- ROCR::prediction(
        glmmTMB:::predict.glmmTMB(mod, type = "response"),
        mod$frame |> dplyr::pull(response)
    )

    # cut rate ----

    # cut
    cut <- ROCR::performance(
        pred,
        "tpr",
        "tnr"
    )

    # create df
    cut_df <- data.frame(
        x = cut@x.values |> unlist(),
        y = cut@y.values |> unlist(),
        alpha = cut@alpha.values |> unlist()
    )
    colnames(cut_df) <- c(cut@x.name, cut@y.name, cut@alpha.name)
    cut_df <- cut_df |>
        data.table::as.data.table() |>
        data.table::melt.data.table(id.vars = cut@alpha.name)

    cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        > 
# ROC function ----

roc_f <- function(mod, response) {
    # generate prediction
    pred <- ROCR::prediction(
        glmmTMB:::predict.glmmTMB(mod, type = "response"),
        mod$frame |> dplyr::pull(response)
    )

    # cut rate ----

    # cut
    cut <- ROCR::performance(
        pred,
        "tpr",
        "tnr"
    )

    # create df
    cut_df <- data.frame(
        x = cut@x.values |> unlist(),
        y = cut@y.values |> unlist(),
        alpha = cut@alpha.values |> unlist()
    )
    colnames(cut_df) <- c(cut@x.name, cut@y.name, cut@alpha.name)
    cut_df <- cut_df |>
        data.table::as.data.table() |>
        data.table::melt.data.table(id.vars = cut@alpha.name)

    cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        gg> # ROC function ----
> 
> roc_f <- function(mod, response) {
    # generate prediction
    pred <- ROCR::prediction(
        glmmTMB:::predict.glmmTMB(mod, type = "response"),
        mod$frame |> dplyr::pull(response)
    )

    # cut rate ----

    # cut
    cut <- ROCR::performance(
        pred,
        "tpr",
        "tnr"
    )

    # create df
    cut_df <- data.frame(
        x = cut@x.values |> unlist(),
        y = cut@y.values |> unlist(),
        alpha = cut@alpha.values |> unlist()
    )
    colnames(cut_df) <- c(cut@x.name, cut@y.name, cut@alpha.name)
    cut_df <- cut_df |>
        data.table::as.data.table() |>
        data.table::melt.data.table(id.vars = cut@alpha.name)

    cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
     +     # generate prediction
    pred <- ROCR::prediction(
        glmmTMB:::predict.glmmTMB(mod, type = "response"),
        mod$frame |> dplyr::pull(response)
    )

    # cut rate ----

    # cut
    cut <- ROCR::performance(
        pred,
        "tpr",
        "tnr"
    )

    # create df
    cut_df <- data.frame(
        x = cut@x.values |> unlist(),
        y = cut@y.values |> unlist(),
        alpha = cut@alpha.values |> unlist()
    )
    colnames(cut_df) <- c(cut@x.name, cut@y.name, cut@alpha.name)
    cut_df <- cut_df |>
        data.table::as.data.table() |>
        data.table::melt.data.table(id.vars = cut@alpha.name)

    cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                +     pred <- ROCR::prediction(
+         glmmTMB:::predict.glmmTMB(mod, type = "response"),
        mod$frame |> dplyr::pull(response)
    )

    # cut rate ----

    # cut
    cut <- ROCR::performance(
        pred,
        "tpr",
        "tnr"
    )

    # create df
    cut_df <- data.frame(
        x = cut@x.values |> unlist(),
        y = cut@y.values |> unlist(),
        alpha = cut@alpha.values |> unlist()
    )
    colnames(cut_df) <- c(cut@x.name, cut@y.name, cut@alpha.name)
    cut_df <- cut_df |>
        data.table::as.data.table() |>
        data.table::melt.data.table(id.vars = cut@alpha.name)

    cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        +         mod$frame |> dplyr::pull(response)
+     )

    # cut rate ----

    # cut
    cut <- ROCR::performance(
        pred,
        "tpr",
        "tnr"
    )

    # create df
    cut_df <- data.frame(
        x = cut@x.values |> unlist(),
        y = cut@y.values |> unlist(),
        alpha = cut@alpha.values |> unlist()
    )
    colnames(cut_df) <- c(cut@x.name, cut@y.name, cut@alpha.name)
    cut_df <- cut_df |>
        data.table::as.data.table() |>
        data.table::melt.data.table(id.vars = cut@alpha.name)

    cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        g        g        g        g   c value
    auc <- + 
    # cut rate ----

    # cut
    cut <- ROCR::performance(
        pred,
        "tpr",
        "tnr"
    )

    # create df
    cut_df <- data.frame(
        x = cut@x.values |> unlist(),
        y = cut@y.values |> unlist(),
        alpha = cut@alpha.values |> unlist()
    )
    colnames(cut_df) <- c(cut@x.name, cut@y.name, cut@alpha.name)
    cut_df <- cut_df |>
        data.table::as.data.table() |>
        data.table::melt.data.table(id.vars = cut@alpha.name)

    cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        g        g        g        g   c value
    auc <- RO+     # cut rate ----

    # cut
    cut <- ROCR::performance(
        pred,
        "tpr",
        "tnr"
    )

    # create df
    cut_df <- data.frame(
        x = cut@x.values |> unlist(),
        y = cut@y.values |> unlist(),
        alpha = cut@alpha.values |> unlist()
    )
    colnames(cut_df) <- c(cut@x.name, cut@y.name, cut@alpha.name)
    cut_df <- cut_df |>
        data.table::as.data.table() |>
        data.table::melt.data.table(id.vars = cut@alpha.name)

    cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        g        g        g        g   c value
    auc <- ROCR::performance(
   + 
    # cut
    cut <- ROCR::performance(
        pred,
        "tpr",
        "tnr"
    )

    # create df
    cut_df <- data.frame(
        x = cut@x.values |> unlist(),
        y = cut@y.values |> unlist(),
        alpha = cut@alpha.values |> unlist()
    )
    colnames(cut_df) <- c(cut@x.name, cut@y.name, cut@alpha.name)
    cut_df <- cut_df |>
        data.table::as.data.table() |>
        data.table::melt.data.table(id.vars = cut@alpha.name)

    cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        g        g        g        g   c value
    auc <- ROCR::performance(
     +     # cut
+     cut <- ROCR::performance(
        pred,
        "tpr",
        "tnr"
    )

    # create df
    cut_df <- data.frame(
        x = cut@x.values |> unlist(),
        y = cut@y.values |> unlist(),
        alpha = cut@alpha.values |> unlist()
    )
    colnames(cut_df) <- c(cut@x.name, cut@y.name, cut@alpha.name)
    cut_df <- cut_df |>
        data.table::as.data.table() |>
        data.table::melt.data.table(id.vars = cut@alpha.name)

    cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        g        g        g        g   c value
    auc <- ROCR::performance(
        pred,
        pred,
R:: "auc"
    ) +         pred,
        "tpr",
        "tnr"
    )

    # create df
    cut_df <- data.frame(
        x = cut@x.values |> unlist(),
        y = cut@y.values |> unlist(),
        alpha = cut@alpha.values |> unlist()
    )
    colnames(cut_df) <- c(cut@x.name, cut@y.name, cut@alpha.name)
    cut_df <- cut_df |>
        data.table::as.data.table() |>
        data.table::melt.data.table(id.vars = cut@alpha.name)

    cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        g        g        g        g   c value
    auc <- ROCR::performance(
        pred,
        pred,
R:: "auc"
    ) |    ) |    ) |+         "tpr",
        "tnr"
    )

    # create df
    cut_df <- data.frame(
        x = cut@x.values |> unlist(),
        y = cut@y.values |> unlist(),
        alpha = cut@alpha.values |> unlist()
    )
    colnames(cut_df) <- c(cut@x.name, cut@y.name, cut@alpha.name)
    cut_df <- cut_df |>
        data.table::as.data.table() |>
        data.table::melt.data.table(id.vars = cut@alpha.name)

    cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        g        g        g        g   c value
    auc <- ROCR::performance(
        pred,
        pred,
R:: "auc"
    ) |    ) |    ) |    ) |    ) ues+         "tnr"
+     )

    # create df
    cut_df <- data.frame(
        x = cut@x.values |> unlist(),
        y = cut@y.values |> unlist(),
        alpha = cut@alpha.values |> unlist()
    )
    colnames(cut_df) <- c(cut@x.name, cut@y.name, cut@alpha.name)
    cut_df <- cut_df |>
        data.table::as.data.table() |>
        data.table::melt.data.table(id.vars = cut@alpha.name)

    cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        g        g        g        g   c value
    auc <- ROCR::performance(
        pred,
        pred,
R:: "auc"
    ) |    ) |    ) |    ) |    ) ues    ) |           ) | + 
    # create df
    cut_df <- data.frame(
        x = cut@x.values |> unlist(),
        y = cut@y.values |> unlist(),
        alpha = cut@alpha.values |> unlist()
    )
    colnames(cut_df) <- c(cut@x.name, cut@y.name, cut@alpha.name)
    cut_df <- cut_df |>
        data.table::as.data.table() |>
        data.table::melt.data.table(id.vars = cut@alpha.name)

    cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        g        g        g        g   c value
    auc <- ROCR::performance(
        pred,
        pred,
R:: "auc"
    ) |    ) |    ) |    ) |    ) ues    ) |           ) |   +     # create df
    cut_df <- data.frame(
        x = cut@x.values |> unlist(),
        y = cut@y.values |> unlist(),
        alpha = cut@alpha.values |> unlist()
    )
    colnames(cut_df) <- c(cut@x.name, cut@y.name, cut@alpha.name)
    cut_df <- cut_df |>
        data.table::as.data.table() |>
        data.table::melt.data.table(id.vars = cut@alpha.name)

    cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        g        g        g        g   c value
    auc <- ROCR::performance(
        pred,
        pred,
R:: "auc"
    ) |    ) |    ) |    ) |    ) ues    ) |           ) |    )  # get true po+     cut_df <- data.frame(
        x = cut@x.values |> unlist(),
        y = cut@y.values |> unlist(),
        alpha = cut@alpha.values |> unlist()
    )
    colnames(cut_df) <- c(cut@x.name, cut@y.name, cut@alpha.name)
    cut_df <- cut_df |>
        data.table::as.data.table() |>
        data.table::melt.data.table(id.vars = cut@alpha.name)

    cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        g        g        g        g   c value
    auc <- ROCR::performance(
        pred,
        pred,
R:: "auc"
    ) |    ) |    ) |    ) |    ) ues    ) |           ) |    )  # get true posi   e &     ) |    ) |
  +         x = cut@x.values |> unlist(),
+         y = cut@y.values |> unlist(),
        alpha = cut@alpha.values |> unlist()
    )
    colnames(cut_df) <- c(cut@x.name, cut@y.name, cut@alpha.name)
    cut_df <- cut_df |>
        data.table::as.data.table() |>
        data.table::melt.data.table(id.vars = cut@alpha.name)

    cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        g        g        g        g   c value
    auc <- ROCR::performance(
        pred,
        pred,
R:: "auc"
    ) |    ) |    ) |    ) |    ) ues    ) |           ) |    )  # get true posi   e &     ) |    ) |
                       erformance(
        pred,
        "tpr",
             +         alpha = cut@alpha.values |> unlist()
    )
    colnames(cut_df) <- c(cut@x.name, cut@y.name, cut@alpha.name)
    cut_df <- cut_df |>
        data.table::as.data.table() |>
        data.table::melt.data.table(id.vars = cut@alpha.name)

    cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        g        g        g        g   c value
    auc <- ROCR::performance(
        pred,
        pred,
R:: "auc"
    ) |    ) |    ) |    ) |    ) ues    ) |           ) |    )  # get true posi   e &     ) |    ) |
                       erformance(
        pred,
        "tpr",
                                    f a        e cols
    +     )
+     colnames(cut_df) <- c(cut@x.name, cut@y.name, cut@alpha.name)
    cut_df <- cut_df |>
        data.table::as.data.table() |>
        data.table::melt.data.table(id.vars = cut@alpha.name)

    cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        g        g        g        g   c value
    auc <- ROCR::performance(
        pred,
        pred,
R:: "auc"
    ) |    ) |    ) |    ) |    ) ues    ) |           ) |    )  # get true posi   e &     ) |    ) |
                       erformance(
        pred,
        "tpr",
                                    f a        e cols
    auc_dat <- data.frame(
        x        x        x        x        x     +     cut_df <- cut_df |>
        data.table::as.data.table() |>
        data.table::melt.data.table(id.vars = cut@alpha.name)

    cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        g        g        g        g   c value
    auc <- ROCR::performance(
        pred,
        pred,
R:: "auc"
    ) |    ) |    ) |    ) |    ) ues    ) |           ) |    )  # get true posi   e &     ) |    ) |
                       erformance(
        pred,
        "tpr",
                                    f a        e cols
    auc_dat <- data.frame(
        x        x        x        x        x        x        x        coln+         data.table::as.data.table() |>
        data.table::melt.data.table(id.vars = cut@alpha.name)

    cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        g        g        g        g   c value
    auc <- ROCR::performance(
        pred,
        pred,
R:: "auc"
    ) |    ) |    ) |    ) |    ) ues    ) |           ) |    )  # get true posi   e &     ) |    ) |
                       erformance(
        pred,
        "tpr",
                                    f a        e cols
    auc_dat <- data.frame(
        x        x        x        x        x        x        x        coln        x        x   c_p        x       +         data.table::melt.data.table(id.vars = cut@alpha.name)

    cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        g        g        g        g   c value
    auc <- ROCR::performance(
        pred,
        pred,
R:: "auc"
    ) |    ) |    ) |    ) |    ) ues    ) |           ) |    )  # get true posi   e &     ) |    ) |
                       erformance(
        pred,
        "tpr",
                                    f a        e cols
    auc_dat <- data.frame(
        x        x        x        x        x        x        x        coln        x        x   c_p        x        x        x        xggp        x        x        x        x    + 
    cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        g        g        g        g   c value
    auc <- ROCR::performance(
        pred,
        pred,
R:: "auc"
    ) |    ) |    ) |    ) |    ) ues    ) |           ) |    )  # get true posi   e &     ) |    ) |
                       erformance(
        pred,
        "tpr",
                                    f a        e cols
    auc_dat <- data.frame(
        x        x        x        x        x        x        x        coln        x        x   c_p        x        x        x        xggp        x        x        x        x      +     cut_plot <- ggplot2::ggplot(
        cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        g        g        g        g   c value
    auc <- ROCR::performance(
        pred,
        pred,
R:: "auc"
    ) |    ) |    ) |    ) |    ) ues    ) |           ) |    )  # get true posi   e &     ) |    ) |
                       erformance(
        pred,
        "tpr",
                                    f a        e cols
    auc_dat <- data.frame(
        x        x        x        x        x        x        x        coln        x        x   c_p        x        x        x        xggp        x        x        x        x        x        x     t,
             +         cut_df,
        ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        g        g        g        g   c value
    auc <- ROCR::performance(
        pred,
        pred,
R:: "auc"
    ) |    ) |    ) |    ) |    ) ues    ) |           ) |    )  # get true posi   e &     ) |    ) |
                       erformance(
        pred,
        "tpr",
                                    f a        e cols
    auc_dat <- data.frame(
        x        x        x        x        x        x        x        coln        x        x   c_p        x        x        x        xggp        x        x        x        x        x        x     t,
                              +         ggplot2::aes(
            x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        g        g        g        g   c value
    auc <- ROCR::performance(
        pred,
        pred,
R:: "auc"
    ) |    ) |    ) |    ) |    ) ues    ) |           ) |    )  # get true posi   e &     ) |    ) |
                       erformance(
        pred,
        "tpr",
                                    f a        e cols
    auc_dat <- data.frame(
        x        x        x        x        x        x        x        coln        x        x   c_p        x        x        x        xggp        x        x        x        x        x        x     t,
                                      .data[[auc_p   +             x = .data[[cut@alpha.name]],
            y =            y =        up             y =            y =        uplot        line(
            ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        g        g        g        g   c value
    auc <- ROCR::performance(
        pred,
        pred,
R:: "auc"
    ) |    ) |    ) |    ) |    ) ues    ) |           ) |    )  # get true posi   e &     ) |    ) |
                       erformance(
        pred,
        "tpr",
                                    f a        e cols
    auc_dat <- data.frame(
        x        x        x        x        x        x        x        coln        x        x   c_p        x        x        x        xggp        x        x        x        x        x        x     t,
                                      .data[[auc_p                                             +             y =            y =        up                   uplot        line(
Error: unexpected '=' in:
"            x = .data[[cut@alpha.name]],
            y =            y ="
>             ggplot2::aes            ggplot2::aes            ggplot2::aes  +
        ggplot2::ggtitle(
            "Cutpoint"
        ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        g        g        g        g   c value
    auc <- ROCR::performance(
        pred,
        pred,
R:: "auc"
    ) |    ) |    ) |    ) |    ) ues    ) |           ) |    )  # get true posi   e &     ) |    ) |
                       erformance(
        pred,
        "tpr",
                                    f a        e cols
    auc_dat <- data.frame(
        x        x        x        x        x        x        x        coln        x        x   c_p        x        x        x        xggp        x        x        x        x        x        x     t,
                                      .data[[auc_p                                                            .  )
    ) +
        ggplot2::geom_line() +
        ggplot2::geom_abline(col = "red") +
        ggplo        ggplo        ggplo        ggplo        ggplo    Error: unexpected symbol in "            ggplot2::aes            ggplot2"
>         ggplot2::ggtitle(
+             "Cutpoint"
+         ) +
                                      ci                     plot2::xlab("Cutpoint") +
        g        g        g        g        g        g        g   c value
    auc <- ROCR::performance(
        pred,
        pred,
R:: "auc"
    ) |    ) |    ) |    ) |    ) ues    ) |           ) |    )  # get true posi   e &     ) |    ) |
                       erformance(
        pred,
        "tpr",
                                    f a        e cols
    auc_dat <- data.frame(
        x        x        x        x        x        x        x        coln        x        x   c_p        x        x        x        xggp        x        x        x        x        x        x     t,
                                      .data[[auc_p                                                            .  )
    ) +
        ggplot2::geom_line() +
        ggplot2::geom_abline(col = "red") +
        ggplo        ggplo        ggplo        ggplo        ggplo        ggplo       te0("AUC: ", round(auc, digits = 3))
        ) +                                       ci                     pl"Cutpoint") +
Error: unexpected symbol in:
"        ) +
                                      ci                     plot2"
>         g        g        g        g        g        g        g   c value
    auc <- ROCR::performance(
        pred,
        pred,
R:: "auc"
    ) |    ) |    ) |    ) |    ) ues    ) |           ) |    )  # get true posi   e &     ) |    ) |
                       erformance(
        pred,
        "tpr",
                                    f a        e cols
    auc_dat <- data.frame(
        x        x        x        x        x        x        x        coln        x        x   c_p        x        x        x        xggp        x        x        x        x        x        x     t,
                                      .data[[auc_p                                                            .  )
    ) +
        ggplot2::geom_line() +
        ggplot2::geom_abline(col = "red") +
        ggplo        ggplo        ggplo        ggplo        ggplo        ggplo       te0("AUC: ", round(auc, digits = 3))
        ) +
            g::theme_wgfd()

    # return ----

    # setup list
    ls <- list(
        auc_val = auc,        auc_val = auc,        auc_val = auc,       Error: unexpected symbol in "        g        g"
>     auc <- ROCR::performance(
+         pred,
+         pred,
+ R:: "auc"
+     ) |    ) |    ) |    ) |    ) ues    ) |           ) |    )  # get true posi   e &     ) |    ) |
Error: unexpected ')' in:
"R:: "auc"
    ) |    )"
>                        erformance(
+         pred,
+         "tpr",
+                                     f a        e cols
Error: unexpected symbol in:
"        "tpr",
                                    f a"
>     auc_dat <- data.frame(
+         x        x        x        x        x        x        x        coln        x        x   c_p        x        x        x        xggp        x        x        x        x        x        x     t,
Error: unexpected symbol in:
"    auc_dat <- data.frame(
        x        x"
>                                       .data[[auc_p                                                            .  )
Error: unexpected symbol in "                                      .data[[auc_p                                                            ."
>     ) +
Error: unexpected ')' in "    )"
>         ggplot2::geom_line() +
+         ggplot2::geom_abline(col = "red") +
+         ggplo        ggplo        ggplo        ggplo        ggplo        ggplo       te0("AUC: ", round(auc, digits = 3))
Error: unexpected symbol in:
"        ggplot2::geom_abline(col = "red") +
        ggplo        ggplo"
>         ) +
Error: unexpected ')' in "        )"
>             g::theme_wgfd()
Error in loadNamespace(x) : there is no package called ‘g’
> 
>     # return ----
> 
>     # setup list
>     ls <- list(
+         auc_val = auc,        auc_val = auc,        auc_val = auc,        auc_val = )
Error: object 'auc' not found
> 
>     # return
>     return(ls)
Error: no function to return from, jumping to top level
> }
Error: unexpected '}' in "}"

Can you fix this issue by yourself? (We appreciate the help)
No

(If applicable) Please attach setting.json

// R path for Mac OS X
"r.rterm.mac": "/usr/local/bin/R",

// Use bracketed paste mode
"r.bracketedPaste": false,

// Enable R session watcher
"r.sessionWatcher": true,

// Delay in milliseconds before sending each line to rterm (only applies if r.bracketedPaste is false)
"r.rtermSendDelay": 8,

Expected behavior
For code to be send to the terminal as expected - like with radian.

Environment (please complete the following information):

  • OS: MacOS
  • VSCode Version: 1.87.0
  • R Version: 4.3.2
  • vscode-R version: v2.8.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing R: Run from Beginning to Line on macOS with the base R terminal, using the reported r.rterm.mac, r.rpath.mac, and r.bracketedPaste settings. Compare behavior with radian and verify that longer scripts execute without garbled, repeated, or otherwise corrupted terminal input.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
cli, developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.