Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Julia's equivalent to R's ?? (double question-mark help.search across all packages)

Tags:

julia

In R you can search the documentation by typing a question mark ? or a double question mark ??. How do you search the manual for strings in the Julia REPL?

>?first
No documentation for ‘first’ in specified packages and libraries:
you could try ‘??first’

>??first

In the R console a browser window opens up:

enter image description here

In RStudio the page is opened within the IDE.

The help() function and ? help operator in R provide access to the documentation pages for R functions, data sets, and other objects, both for packages in the standard R distribution and for contributed packages.

The help() function and ? operator are useful only if you already know the name of the function that you wish to use. Other ways to search include apropos and ??

The apropos() function searches for objects, including functions, directly accessible in the current R session that have names that include a specified character string.

The ?? operator is a synonym for help.search(). The help.search() function scans the documentation for packages installed in your library. The argument to help.search() is a character string or regular expression.

P.S. I intend to answer my own question.

like image 423
PatrickT Avatar asked Nov 07 '22 01:11

PatrickT


1 Answers

Julia has similar interactive utilties. Julia's main search utility for docstrings is named apropos.

To search the documentation for information about "first" in Julia, you have apropos("first") or equivalently ?"first". Thus ?"first" is roughly equivalent to R's ??.

To search for functions and methods, you can type a singe question mark ?, just as with R. In the Julia REPL, as you type the question mark, the prompt changes to a question mark. If you type "first" it searches through strings, while if you type first without quote-marks, you get a search over variables exported by the modules currently loaded.

Illustration:

help?>"first"  

# or equivalently:

julia>apropos("first")

enter image description here

help?>first 

enter image description here

If you search for a string, case is ignored. If you want to search within the DataFrames module, type using DataFrames before searching.

This also works in Visual Studio Code and Atom:

enter image description here

like image 75
PatrickT Avatar answered Jun 04 '23 00:06

PatrickT