setPrompt | R Documentation |
set R prompt with project name and R version
setPrompt(
projectName = NULL,
useColor = TRUE,
projectColor = "yellow",
bracketColor = "white",
Rcolors = c("white", "white", "white"),
PIDcolor = NA,
promptColor = "white",
usePid = TRUE,
resetPrompt = FALSE,
addEscape = NULL,
debug = FALSE,
verbose = FALSE,
...
)
projectName |
|
useColor |
|
projectColor , bracketColor , Rcolors , PIDcolor , promptColor |
|
usePid |
|
resetPrompt |
|
addEscape |
|
debug |
|
verbose |
|
... |
additional parameters are passed to |
This function sets the R prompt including project name, the R version, and the process ID. It is intended to be useful by reinforcing the active project for an R session, particularly when there may be multiple R sessions active. The R version can be useful when running R on different machines, to reinforce which version of R is active on the given machine. The process ID is mainly helpful in the event an R process spins out of control, and it would be useful to know definitively which exact process ID is stuck, so that it can be killed without affecting other R sessions inadvertently.
The prompt is defined in options("prompt")
.
Note that in some cases, the color encoding of the prompt interferes with word wrapping, the symptom is that when typing text into the R console a long line will begin to word wrap prematurely, before the text reaches the edge of the screen. There are two frequent causes of this issue:
is sometimes defined too narrow for the
screen, which can happen when resizing the console, or when
accessing an R session via GNU screen, or tmux, and the environment
variable has not been propagated to the terminal window. Usually
this issue is resolved by defining options("width")
manually,
or by simply resizing the terminal window, which may trigger the
appropriate environment variable updates.
can sometimes be mismatched with the terminal window,
usually caused by some terminal emulation layer which is not
properly detecting the compatibility of the server. It may happen
for example, when using PuTTY on Windows, or when using GNU screen or
tmux on linux or Mac OSX. To troubleshoot, check
Sys.env("LC_ALL")
which may be "C"
or another locale such as
"en_US.UTF-8"
. Note that switching locale may have the effect of
correcting the word wrap, but may adversely affect display of
non-standard unicode characters.
In any event, R uses readline for unix-like systems by default, and issues related to using color prompt are handled at that level. For example, in some Mac OSX consoles, there are alternate color escape sequences which are used to tell readline to ignore an escape sequence when it counts the number of characters being displayed by the prompt.
character
string representing the prompt used, returned
invisibly.
Other jam practical functions:
breakDensity()
,
checkLightMode()
,
check_pkg_installed()
,
colNum2excelName()
,
color_dither()
,
diff_functions()
,
exp2signed()
,
fileInfo()
,
fixYellow()
,
getAxisLabel()
,
handleArgsText()
,
heads()
,
isFALSEV()
,
isTRUEV()
,
jamba
,
jargs()
,
kable_coloring()
,
lldf()
,
log2signed()
,
make_html_styles()
,
make_styles()
,
match_unique()
,
mergeAllXY()
,
middle()
,
minorLogTicks()
,
newestFile()
,
printDebug()
,
renameColumn()
,
rmInfinite()
,
rmNAs()
,
rmNA()
,
rmNULL()
,
sclass()
,
sdim()
## Not run:
setPrompt("jamba", projectColor="purple");
setPrompt("jamba", usePid=FALSE);
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.