question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

R markdown: Knit button and keyboard knit shortcut doesn't work

See original GitHub issue

Describe the bug I use the same rmd file as in #886 in this report. (The preview problem has been fixed.) When the setting “Knit: Use Background Process” is on, the knit button and keyboard shortcut (Ctrl + Shift + k) don’t work. The output panel of R markdown showed nothing. But after turning off the “Knit: Use Background Process”, the rmd file can be knitted correctly.

To Reproduce Steps to reproduce the behavior:

  1. turn on “Knit: Use Background Process”
  2. Click on ‘Knit’

Do you want to fix by self? (We hope your help!)

No, I don’t know how vscode works.

// R.exe path for windows
"r.rterm.windows": "D:\Softwares\Anaconda3\Scripts\radian.exe",

// R path for Mac OS X
"r.rterm.mac": "",

// R path for Linux
"r.rterm.linux": "",

// R command line options (i.e: --vanilla)
"r.rterm.option": [--no-save --no-restore],

// An optional encoding to pass to R when executing the file, i.e. 'source(FILE, encoding=ENCODING)'
"r.source.encoding": "UTF-8",

// Keeping focus when running
"r.source.focus": "editor",

// Use active terminal for all commands, rather than creating a new R terminal
"r.alwaysUseActiveTerminal": false,

// Use bracketed paste mode
"r.bracketedPaste": false,

// Enable R session watcher
"r.sessionWatcher": true,

// Delay in milliseconds before sending each line to rterm (only applies if r.bracketedPaste is false)
"r.rtermSendDelay": 8,

Expected behavior The rmd file can be knitted correctly when “Knit: Use Background Process” is on.

Screenshots “Knit: Use Background Process” is on: image

“Knit: Use Background Process” is off: image

Environment (please complete the following information):

  • OS: Windows
  • VSCode Version: 1.62.3 (user setup)
  • R Version: 4.1.1
  • vscode-R version: v2.3.4

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
renkun-kencommented, Dec 6, 2021

@ElianHugh Looks like we should check the usage of workspace folder in the rmarkdown part of code.

1reaction
LeiGuo0812commented, Dec 6, 2021

Before reporting the bug, I’d only ever tried to knit after opening an R markdown file. I’ve tried to load a workspace induced by the file I’m working on, but that seems to do nothing either unlike for @LeiGuo0812. The workspace is correctly saved and loaded by vscode-R and all objects are present, but CTRL+Shift+K to knit and the graphical shortcut seem to be unresponsive.

I believe that it’s just a misunderstanding. The workspace Elian is talking about is the working path set by the explorer in the sidebar, not the .rdata file. After setting the directory in explorer, the button should work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

17.1 Use RStudio keyboard shortcuts | R Markdown Cookbook
Task Windows & Linux macOS Insert R chunk Ctrl+Alt+I Command+Option+I Preview HTML Ctrl+Shift+K Command+Shift+K Knitr document (knitr) Ctrl+Shift+K Command+Shift+K
Read more >
Knitr button completely unresponsive - R Markdown
Hi there, When I try to press the 'Knit' button on RStudio - nothing happens. Literally nothing occurs. A "R Markdown" dialog box...
Read more >
Find keyboard shortcuts don't work in knitted R Markdown ...
Knit an R Markdown file with preview in window. Describe the problem in detail. The keyboard shortcut for finding, CMD-F , doesn't go...
Read more >
I can't find "Knit" button in RStudio - Stack Overflow
RMD file the knitting will not work. Then in your file explorer, find where you saved the file. Right-click the file and click...
Read more >
15 Common Problems with rmarkdown (and some solutions)
To avoid problems in the first place, I try and do the following: Develop code in chunks and execute the chunks until they...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found