Learn R Programming

prompt

Dynamic R Prompt

Set the R prompt dynamically, from a function. The package contains some examples.

Examples

This is prompt_fancy() and it has

  • The status of the last command (success or failure).
  • The amount of memory allocated by the current R process.
  • The name of the R package being developed using devtools.
  • Name of the active git branch.
  • State of the git working tree (needs pushes, pulls, and/or dirty).

A powerline clone, that also shows the system load average and the current working directory.

Installation

Install the package from CRAN, as usual:

install.packages("prompt")

Usage

Use one of the pre-defined prompts, as on the screenshots, or create your own. You can set the prompt in your .Rprofile. Maybe you only want to do this in interactive mode:

if (interactive()) prompt::set_prompt(prompt::prompt_fancy)

or the powerline prompt:

if (interactive()) prompt::set_prompt(prompt::new_prompt_powerline())

License

MIT © Gábor Csárdi

Copy Link

Version

Install

install.packages('prompt')

Monthly Downloads

258

Version

1.0.2

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Gabor Csardi

Last Published

August 31st, 2023

Functions in prompt (1.0.2)

prompt_git

An example 'git' prompt
prompt_mem

Example prompt that shows the current memory usage of the R process
prompt_runtime

A prompt that shows the CPU time used by the last top level expression
new_prompt_powerline

This is a Powerline-like prompt
prompt_devtools

Example prompt that shows the package being developed with devtools
prompt

Dynamic R Prompt
set_prompt

Set and control the prompt
prompt_status

A prompt that shows the status (OK or error) of the last expression
prompt_fancy

A fancy prompt, showing probably too much information