navigateToFile: Navigate to File

Description Usage Arguments Details Note

View source: R/stubs.R

Description

Open a file in RStudio, optionally at a specified location.

Usage

1
navigateToFile(file, line = -1L, column = -1L)

Arguments

file

Path to the file to open)

line

Optional; integer specifying the line number on which to place the cursor

column

Optional; integer specifying the column number on which to place the cursor

Details

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 line and column arguments are both equal to -1L (the default), then the cursor position in the document that is opened will be preserved.

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.

Note

The navigateToFile function was added in version 0.99.719 of RStudio.


rstudio/rstudioapi documentation built on Feb. 16, 2019, 5:42 a.m.