找回密码
 注册
查看: 315|回复: 0

R语言 sfsmisc包 AsciiToInt()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-30 01:35:30 | 显示全部楼层 |阅读模式
AsciiToInt(sfsmisc)
AsciiToInt()所属R语言包:sfsmisc

                                        Character to and from Integer Codes Conversion
                                         字符和整数代码转换

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

AsciiToInt returns integer codes in 0:255 for each (one byte) character in strings.  ichar is an alias for it, for old S compatibility.
AsciiToInt返回integer代码0:255strings每个字符(一个字节)。 ichar是一个别名,老S兼容性。

strcodes implements in R the basic engine for translating characters to corresponding integer codes.
strcodes在R实现了基本的引擎为相应的整数代码转换的字符。

chars8bit() is the inverse function of AsciiToint, producing (one byte) characters from integer codes.
chars8bit()的AsciiToint,是反函数的整数代码字符(一个字节)。


用法----------Usage----------


AsciiToInt(strings)
     ichar(strings)
chars8bit(i = 1:255)
strcodes(x, table = chars8bit(1:255))



参数----------Arguments----------

参数:strings, x
character vector.
character向量。


参数:i
numeric (integer) vector of values in 1:255.
数字(整数)的矢量值在1:255。


参数:table
a vector of (unique) character strings, typically of one character each.
(唯一的)的字符串,典型地为每一个字符的一个向量。


Details

详细信息----------Details----------

Only codes in 1:127 make up the ASCII encoding which should be identical for all R versions, whereas the "upper" half is often determined from the ISO-8859-1 (aka “ISO-Latin 1)” encoding, but may well differ, depending on the locale setting, see also Sys.setlocale.
只有代码的1:127的ASCII编码,所有的R版本应该是相同的,而往往决定从ISO-8859-1“(又名”ISO拉丁1)“上的”半编码,但可能会有所不同,这取决于系统的区域设置,参见Sys.setlocale。

Note that 0 is no longer allowed since, R does not allow \0 aka nul characters in a string anymore.
注意0不再是不允许的,因为,R不允许\0的又名nul在一个字符串中的字符了。


值----------Value----------

AsciiToInt (and hence ichar) and chars8bit return a vector of the same length as their argument.
AsciiToInt(并因此ichar)和chars8bit返回它们的参数相同的长度的矢量。

strcodes(x, tab) returns a list of the same length and names as x with list components of integer vectors with codes in 1:255.
strcodes(x, tab)返回一个list的相同length和namesx列表组件的整数向量代码在1:255。


(作者)----------Author(s)----------


Martin Maechler, partly in 1991 for S-plus



实例----------Examples----------


chars8bit(65:70)#-> "A" "B" .. "F"[ - >“A”,“B”。 “F”的]
stopifnot(identical(LETTERS,   chars8bit(65:90)),
          identical(AsciiToInt(LETTERS), 65:90))
## Not run: [#不运行:]
## may only work in ISO-latin1 locale (not in UTF-8):[#可能仅适用于ISO-latin1的语言环境(UTF-8):]
strcodes(c(a= "ABC", ch="1234", place = "Z眉rich"))
## gives[#给]
$a
[1] 65 66 67

$ch
[1] 49 50 51 52

$place
[1]  90 252 114 105  99 104

## End(Not run)[#(不执行)]

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-5-21 05:35 , Processed in 0.025534 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表