R General Tips and Tricks
Teresa Engelbrecht, Marta Bofill Roig, Pavla Krotka
toolkit.Rmd
General hacks & shortcuts
Multi-line editing
- Use
alt
to mark multiple lines
Discovered this beautiful @rstudio #rstats hack a few days ago, wish I had known earlier. pic.twitter.com/b5vuB4l9Ho
β Eiko Fried (@EikoFried) December 3, 2018
- Use
ctrl + alt_left + mouse_left
to spawn multiple cursors
Multi-cursor editing - Repetetive code is quickly written but hard to edit. Use πππΏπΉ + ππΉπ_πΉπ²π³π + π πΌπππ²_πΉπ²π³π to spawn multiple cursors. Hold ππΉπ_πΉπ²π³π + π πΌπππ²_πΉπ²π³π and drag your mouse to edit consecutive lines at the same position. (4/7) pic.twitter.com/1uOOgcIOkd
β Christian KΓΆnig (@Chr_Koenig) April 8, 2022
Commenting blocks
- Use
ctrl + Shift + c
to comment/uncomment an entire code block
Comment/uncomment blocks - Sometimes you want to quickly disable a chunk of code without deleting it. Use πππΏπΉ + π¦π΅πΆπ³π + π to (un)comment entire code blocks. (3/7) pic.twitter.com/KOH65ic4zv
β Christian KΓΆnig (@Chr_Koenig) April 8, 2022
Moving selections
- Use
alt_left + up/down
to move selections up and down
Move selection - Instead of copy/pasting code chunks you can simply move them up and down by pressing ππΉπ_πΉπ²π³π + π¨π½/ππΌππ». (5/7) pic.twitter.com/3z11ZQkCIj
β Christian KΓΆnig (@Chr_Koenig) April 8, 2022