set.jupyter.path {this.path}R Documentation

Declare Executing 'Jupyter' Notebook's Filename

Description

this.path() does some guess work to determine the path of the executing notebook in ‘Jupyter’. This involves listing all the files in the initial working directory, filtering those which are R notebooks, then filtering those with contents matching the top-level expression.

This could possibly select the wrong file if the same top-level expression is found in another file. As such, you can use set.jupyter.path() to declare the executing ‘Jupyter’ notebook's filename.

Usage

set.jupyter.path(...)

Arguments

...

further arguments passed to path.join(). If no arguments are provided or exactly one argument is provided that is NA or NULL, the ‘Jupyter’ path is unset.

Details

This function may only be called from a top-level context in ‘Jupyter’. It is recommended that you do NOT provide an absolute path. Instead, provide just the basename and the directory will be determined by the initial working directory.

Value

character string, invisibly; the declared path for ‘Jupyter’.

Examples

# ## if you opened the file "~/file50b816a24ec1.ipynb", the initial
# ## working directory should be "~". You can write:
#
# set.jupyter.path("file50b816a24ec1.ipynb")
#
# ## and then this.path() will return "~/file50b816a24ec1.ipynb"

[Package this.path version 2.4.0 Index]