txtProgressBar(utils)
txtProgressBar()所属R语言包:utils
Text Progress Bar
文字的进度条
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Text progress bar in the R console.
在R控制台文字的进度条。
用法----------Usage----------
txtProgressBar(min = 0, max = 1, initial = 0, char = "=",
width = NA, title, label, style = 1, file = "")
getTxtProgressBar(pb)
setTxtProgressBar(pb, value, title = NULL, label = NULL)
## S3 method for class 'txtProgressBar'
close(con, ...)
参数----------Arguments----------
参数:min, max
(finite) numeric values for the extremes of the progress bar. Must have min < max.
进度条的极端数值(有限)。必须有min < max。
参数:initial, value
initial or new value for the progress bar. See "Details" for what happens with invalid values.
进度条的初始或新的价值。无效值的情况,请参阅“详细资料”。
参数:char
the character (or character string) to form the progress bar.
字符(或字符串)形成的进度条。
参数:width
the width of the progress bar, as a multiple of the width of char. If NA, the default, the number of characters is that which fits into getOption("width").
进度条的宽度,的char宽度的倍数。如果NA,默认的字符数是适合到getOption("width")。
参数:style
the "style" of the bar – see "Details".
“风格”的条形 - “详细资料”。
参数:file
an open connection object or "" which indicates the console: stderr() might be useful here.
一个开放的连接对象或""这表明控制台:stderr()这里可能是有用的。
参数:pb, con
an object of class "txtProgressBar".
对象类"txtProgressBar"。
参数:title, label
ignored, for compatibility with other progress bars.
忽略,与其他进度条的兼容性。
参数:...
for consistency with the generic.
与通用的一致性。
Details
详情----------Details----------
txtProgressBar will display a progress bar on the R console (or a connection) via a text representation.
txtProgressBar会显示一个进度条上的R控制台(或连接)通过文字表示。
setTxtProgessBar will update the value. Missing (NA) and out-of-range values of value will be (silently) ignored. (Such values of initial cause the progress bar not to be displayed until a valid value is set.)
setTxtProgessBar将更新值。失踪(NA)value(默默)忽略和范围的值。 (这种价值initial导致进度条不显示,直到一个有效的值设置。)
The progress bar should be closed when finished with: this outputs the final newline character.
进度栏应该是closeD完成后输出最后的换行符。
style = 1 and style = 2 just shows a line of char. They differ in that style = 2 redraws the line each time, which is useful if other code might be writing to the R console. style = 3 marks the end of the range by | and gives a percentage to the right of the bar.
style = 1和style = 2只是显示了char行。他们的区别在于style = 2每次重绘行,这是有用的,如果其他的代码可以写的R控制台。 style = 3标志着范围|的结束,并给出一个百分比栏右侧。
值----------Value----------
For txtProgressBar an object of class "txtProgressBar".
txtProgressBar类对象"txtProgressBar"。
For getTxtProgressBar and setTxtProgressBar, a length-one numeric vector giving the previous value (invisibly for setTxtProgressBar).
getTxtProgressBar和setTxtProgressBar,长度一个数字向量,使以前的值(无形setTxtProgressBar)。
注意----------Note----------
Using style 2 or 3 or reducing the value with style = 1 uses \r to return to the left margin – the interpretation of carriage return is up to the terminal or console in which R is running, and this is liable to produce ugly output on a connection other than a terminal, including when stdout() is redirected to a file.
使用style2或3或减少价值style = 1使用\r返回到左边缘 - 回车的解释是其中R正在运行的终端或控制台,并产生一个连接终端以外的丑陋的输出,包括当stdout()重定向到一个文件,这是责任。
参见----------See Also----------
winProgressBar, tkProgressBar.
winProgressBar,tkProgressBar。
举例----------Examples----------
testit <- function(x = sort(runif(20)), ...)
{
pb <- txtProgressBar(...)
for(i in c(0, x, 1)) {Sys.sleep(0.5); setTxtProgressBar(pb, i)}
Sys.sleep(1)
close(pb)
}
testit()
testit(runif(10))
testit(style=3)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|