navigateToFile | R Documentation |
Open a file in RStudio, optionally at a specified location.
navigateToFile(
file = character(0),
line = -1L,
column = -1L,
moveCursor = TRUE
)
file |
The file to be opened. |
line |
The line number where the cursor should be placed. When |
column |
The column number where the cursour should be placed. When
|
moveCursor |
Boolean; should the cursor be moved to the requested
( |
The navigateToFile
opens a file in RStudio. If the file is already
open, its tab or window is activated.
Once the file is open, the cursor is moved to the specified location. If the
file
argument is empty (the default), then the file is the file
currently in view if one exists. If the line
and column
arguments are both equal to -1L
(the default), then the cursor
position in the document that is opened will be preserved. Alternatively,
moveCursor
can be set to FALSE
to preserve the cursor position.
Note that if your intent is to navigate to a particular function within a
file, you can also cause RStudio to navigate there by invoking
View
on the function, which has the advantage of
falling back on deparsing if the file is not available.
The navigateToFile
function was added in version 0.99.719 of
RStudio.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.