Recently the RStudio shortcut for the pipe operator %>%
stopped working. This appeared to have occurred randomly, as I didn't update anything. Does anyone know what is going on and how I might fix this?
> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dplyr_1.0.7
loaded via a namespace (and not attached):
[1] rstudioapi_0.13 knitr_1.34 magrittr_2.0.1 tidyselect_1.1.1
[5] R6_2.5.1 rlang_0.4.11 fastmap_1.1.0 fansi_0.5.0
[9] tools_4.1.0 xfun_0.25 utf8_1.2.2 cli_3.0.1
[13] DBI_1.1.1 htmltools_0.5.2 ellipsis_0.3.2 yaml_2.2.1
[17] digest_0.6.27 assertthat_0.2.1 tibble_3.1.3 lifecycle_1.0.0
[21] crayon_1.4.1 purrr_0.3.4 vctrs_0.3.8 glue_1.4.2
[25] evaluate_0.14 rmarkdown_2.10 compiler_4.1.0 pillar_1.6.2
[29] generics_0.1.0 pkgconfig_2.0.3
It appears that many people are having this issue across R and RStudio versions (https://community.rstudio.com/t/ctrl-shift-m-pipe-operator-shortcut-is-suddenly-stop-working-since-this-morning/118362), and may be due to a conflict with the default Ctrl+Shift+M being a shortcut for another process (seems to be "mute" in WebEx for many; see comments and other answers below).
In your RStudio IDE if you go to the "Tools" tab and select "Modify Keyboard Shortcuts..." you can see a list of shortcuts. If you type "pipe" into the search bar at the top, you will see that "Insert Pipe Operator" is still set to Ctrl+Shift+M, yet it does not work.
The simple solution that I chose is to click on this "Ctrl+Shift+M", once highlighted, type in a new shortcut by pressing the keys you would use for that shortcut (although there is likely a more elegant solution than changing your shortcut).
I chose "Ctrl+Shift+," since the comma is only one space away from M on my keyboard.