8

According to the shortcuts help (Alt+Shift+K) the combination Ctrl+Shift+D should run the documentation routines. (This is also said in Section 5.1 of Hadley Wickhams "R packages" http://runsheng.github.io/attachment/r-packages.pdf.) But in my RStudio-setting, it doublicates the selected row (so I don't belive it is a global usage problem brought up in the answers here: Visual Studio won't recognize key combination). On https://support.rstudio.com/hc/en-us/community/posts/201819358-Ctrl-Shift-D-doesn-t-run-document-in-preview-release the issue was brought up by someone, but without a solution. How can I make RStudio do what it should do?


I'm using RStudio version 0.99.902 and sessionInfo() gives:

R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252   
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C                   
[5] LC_TIME=German_Germany.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] hmi_0.1.0       roxygen2_5.0.1  coda_0.18-1     MASS_7.3-45    devtools_1.12.0

loaded via a namespace (and not attached):
[1] magrittr_1.5    tools_3.3.1     withr_1.0.2     rstudioapi_0.6  Rcpp_0.12.5    
[6] memoise_1.0.0   stringi_1.1.1   grid_3.3.1      stringr_1.0.0   digest_0.6.9   
[11] lattice_0.20-33
Community
  • 1
  • 1
Qaswed
  • 2,629
  • 4
  • 21
  • 38
  • Just wanted to say I have this problem as well, and didn't have it until about a month ago. I believe this may be a bug in the new version of RStudio. @Qaswed, you can go to RStudio > Tools > Modify Keyboard Shortcuts and manually edit out the shortcut for "Duplicate Selection", which is now set to the same keys as documenting package – Luis Usier Jul 06 '16 at 10:29
  • Thank you @LuisUsier for the hints. When I changed "Duplicate Selection" to something else (I've chosen Shift+Alt+F), Ctrl+Shift+D didn't do anything. Also when I changed "Roxygenize Package" (what should be the name of the desired shortcut) to Ctrl+Shift+Y. – Qaswed Jul 06 '16 at 11:32
  • Yes, the same has been happening for me. – Luis Usier Jul 06 '16 at 13:57

1 Answers1

12

Can you double check what these options are set to in Project Options?

enter image description here

You might need to ensure that both

  • Use devtools package functions in available
  • Generate documentation with Roxygen

are both checked.

Kevin Ushey
  • 17,893
  • 4
  • 48
  • 77
  • 1
    "Generate documentation with Roxygen" wasn't checked. Checking it solved the problem. Thank you! – Qaswed Jul 11 '16 at 06:23
  • I am having the same problem in Rstudio 1.0.143 in Ubuntu 14.04. I get this error in the Build pane when running Ctrl + Shift + D ```==> devtools::document(roclets=c('rd','collate','namespace')) Error in check_dep_version(pkg, version, compare) : Dependency package roxygen2 not available. Calls:suppressPackageStartupMessages... ->check_suggested ->check_dep_version Execution halted Exited with status 1``` However, when I run the same command from the console ```devtools::document(roclets = c("rd","collate","namespace"))``` – code_cowboy Jan 11 '18 at 17:34