# NOT RUN {
# }
# NOT RUN {
# Need to run in RStudio
# Please read the Section 'Details' carefully
# --------------------------------------------
# I assume the shortcuts are Alt+1,2,...,9,0,
# corresponding to shortcuts 1 - 10
# Adds an insertion to Alt+9
rs_add_insertion_shortcut(9, " %?<-% ", force = TRUE)
# restart RStudio and try `Alt+9`
# Adds an expression to Alt+1
rs_add_shortcut(1, {
expr <- sprintf("system.time({\n%s\n})\n",
rstudioapi::selectionGet()$value)
cat(expr)
eval(parse(text = expr))
}, force = TRUE)
# Select any valid R code and press Alt+1
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab