back2ForwardSlash(sos)
back2ForwardSlash()所属R语言包:sos
Replace backslash with forward slash in a character string
斜线替换反斜线字符字符串
译者:生物统计家园网 机器人LoveR
描述----------Description----------
scan a character string with backslash as the quote character and return it with backslashs replaced by forward slash.
扫描的引号字符用反斜杠字符的字符串并返回它backslashs换成斜杠。
NOTE: 'c:\User' cannot be assigned to a character variable, because '\U' must be followed by a hexidecimal number, and 's' is not a legal hexidecimal digit. Therefore, we read the character string of interest using scan rather than assigning it to a function argument.
注:“C:\用户不能被分配到一个字符变量,因为\ U必须遵循的一个十六进制数,和s是不是一个合法的十六进制数字。因此,我们读到的利益扫描,而不是将其分配给一个函数的参数的字符串。
用法----------Usage----------
back2ForwardSlash(nmax=1, what=character(), sep='\n', ...)
参数----------Arguments----------
参数:nmax, what, sep, ...
arguments passed to scan
参数传递给scan
Details
详细信息----------Details----------
It's not easy to turn a back slash into a forward slash, because R interprets the back slash as an escape character. back2ForwardSlash tells R to read the next nmax lines, replacing '\' with '/'.
这是不容易转成一个正斜杠反斜杠,因为R解释反斜杠作为转义字符。 back2ForwardSlashř告诉,读取下一个nmax线,以/代替\。
值----------Value----------
character vector with backslashes replaced by forward slashes.
代替正斜杠与反斜杠字符向量。
(作者)----------Author(s)----------
Spencer Graves with help from Richard Cotton and Garrett See
参见----------See Also----------
scan gsub Quotes
scangsubQuotes
实例----------Examples----------
(x <- back2ForwardSlash())
#c:\users\[C:\用户\]
#NOTE: The "#" in this example is not needed.[注意:在这个例子中的“#”是不需要的。]
# It is included here to suppress a spurious warning[它包括在这里压制的伪警告]
# in the automated testing of the package via "R CMD check".[在自动化测试的包通过“R CMD检查”的。]
all.equal(x, '#c:/users/')[C :/用户/)]
(x2. <- back2ForwardSlash(2))
#c:\u\a b\n o[C:\ U \ A B \ N O]
#d:\pqr\[D:\ PQR \]
all.equal(x2., c('#c:/u/a b/n o', '#d:/pqr/'))[C :/ U / A B / N O,#D :/ PQR /))]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|