Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rstudio pipe operator (%>%) shortcut (Ctrl+Shift+M) not working

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 
like image 431
Dylan_Gomes Avatar asked Oct 25 '21 20:10

Dylan_Gomes


People also ask

What does Ctrl Shift Enter do in R?

R Studio: ctrl+shift+enter runs the entire code instead of the selected lines only [closed]

How do I run a keyboard shortcut in R?

Shortcuts to run R code Alt + Enter – Allows running code without moving the cursor to the next line if you want to run one line of code multiple times without selecting it. Ctrl + Alt + R – Runs the entire script.

What is the RStudio keyboard shortcut for inserting the pipe operator?

In RStudio the keyboard shortcut for the pipe operator %>% is Ctrl + Shift + M (Windows) or Cmd + Shift + M (Mac).


Video Answer


3 Answers

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.

like image 155
Dylan_Gomes Avatar answered Nov 07 '22 08:11

Dylan_Gomes


I am sure it is WebEx after I experimented restart/kill the process of Webex.

edit: after ending the process in the task manager (open task manager, find webex and end process) ctrl+shift+m works again. (Windows 10)

like image 34
SJ9 Avatar answered Nov 07 '22 08:11

SJ9


I had the same problem. I suppose it comes from WebEx as mentioned in the comments. I uninstalled WebEx but the problem remained. Then I cleaned Windows registry using the tool in CCleaner software and now the pipe shortcut is working again !

like image 32
Vizcachart Avatar answered Nov 07 '22 06:11

Vizcachart