locales(base)
locales()所属R语言包:base
Query or Set Aspects of the Locale
查询或设置方面的Locale
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Get details of or set aspects of the locale for the R process.
获取或设置为R进程的区域方面。
用法----------Usage----------
Sys.getlocale(category = "LC_ALL")
Sys.setlocale(category = "LC_ALL", locale = "")
参数----------Arguments----------
参数:category
character string. The following categories should always be supported: "LC_ALL", "LC_COLLATE", "LC_CTYPE", "LC_MONETARY", "LC_NUMERIC" and "LC_TIME". Some systems (not Windows) will also support "LC_MESSAGES", "LC_PAPER" and "LC_MEASUREMENT".
字符串。以下几类应始终支持:"LC_ALL","LC_COLLATE","LC_CTYPE","LC_MONETARY","LC_NUMERIC"和"LC_TIME"。一些系统(而不是Windows)也将支持"LC_MESSAGES","LC_PAPER"和"LC_MEASUREMENT"。
参数:locale
character string. A valid locale name on the system in use. Normally "" (the default) will pick up the default locale for the system.
字符串。系统在使用上的一个有效的语言环境名称。通常""(默认)将拿起系统默认语言环境。
Details
详情----------Details----------
The locale describes aspects of the internationalization of a program. Initially most aspects of the locale of R are set to "C" (which is the default for the C language and reflects North-American usage). R sets "LC_CTYPE" and "LC_COLLATE", which allow the use of a different character set and alphabetic comparisons in that character set (including the use of sort), "LC_MONETARY" (for use by Sys.localeconv) and "LC_TIME" may affect the behaviour of as.POSIXlt and strptime and functions which use them (but not date).
语言环境描述程序的国际化方面。最初的大多数方面研发的区域设置"C"(这是默认为C语言,反映了北美使用)。 R设置"LC_CTYPE"和"LC_COLLATE",它允许使用该字符集(包括使用sort)"LC_MONETARY"(使用不同的字符集和字母比较Sys.localeconv)"LC_TIME"可能影响as.POSIXlt和strptime“功能使用(但不date)的行为。
The first seven categories described here are those specified by POSIX. "LC_MESSAGES" will be "C" on systems that do not support message translation, and is not supported on Windows. Trying to use an unsupported category is an error for Sys.setlocale.
第一七类,这里描述的是那些由POSIX指定。 "LC_MESSAGES"会"C"不支持邮件翻译功能,不支持在Windows系统上。试图使用不受支持的类别是错误Sys.setlocale。
Note that setting category "LC_ALL" sets only "LC_COLLATE", "LC_CTYPE", "LC_MONETARY" and "LC_TIME".
请注意,设置类别"LC_ALL"设置"LC_COLLATE","LC_CTYPE","LC_MONETARY"和"LC_TIME"。
Attempts to set an invalid locale are ignored. There may or may not be a warning, depending on the OS.
试图设置一个无效的语言环境被忽略。可能有也可能没有一个警告,这取决于操作系统。
Attempts to change the character set (by Sys.setlocale("LC_TYPE", ), if that implies a different character set) during a session may not work and are likely to lead to some confusion.
企图改变字符集(由Sys.setlocale("LC_TYPE", ),如果那意味着一个不同的字符集)在会议期间可能无法正常工作,并有可能导致一些混乱。
值----------Value----------
A character string of length one describing the locale in use (after setting for Sys.setlocale), or an empty character string if the current locale settings are invalid or NULL if locale information is unavailable.
一个字符串的长度描述的语言环境中使用(设置后Sys.setlocale),或空字符串,如果当前的区域设置是无效的或NULL如果区域设置信息不可用。
For category = "LC_ALL" the details of the string are system-specific: it might be a single locale name or a set of locale names separated by "/" (Solaris, Mac OS X) or ";" (Windows, Linux). For portability, it is best to query categories individually: it is not necessarily the case that the result of foo <- Sys.getlocale() can be used in Sys.setlocale("LC_ALL", locale = foo).
category = "LC_ALL"字符串的细节是系统特定的:它可能是一个单一的语言环境名称或一套"/"(Solaris上的Mac OS X)或";"(分隔的语言环境名称在Windows,Linux)。可移植性,最好是单独查询类别:它不一定的情况下,的foo <- Sys.getlocale()结果可以在Sys.setlocale("LC_ALL", locale = foo)使用。
警告----------Warning----------
Setting "LC_NUMERIC" may cause R to function anomalously, so gives a warning. Input conversions in R itself are unaffected, but the reading and writing of ASCII save files will be, as may packages. Almost all the output routines used by R itself under Windows ignore the setting of "LC_NUMERIC" since they make use of the Trio library which is not internationalized.
设置可能导致"LC_NUMERIC"R以功能异常,因此,给予警告。 R本身的输入转换的影响,但ASCII码save文件将作为5包,阅读和写作。几乎所有的输出由R在Windows下使用的例程忽略设置"LC_NUMERIC"因为他们没有被国际化的三重奏库使用。
注意----------Note----------
Changing the values of locale categories whilst R is running ought to be noticed by the OS services, and usually is but exceptions have been seen (usually in collation services).
更改而ŕ语言环境类别的值应该被注意到OS服务,通常是,但已经看到异常(通常是在整理服务)。
参见----------See Also----------
strptime for uses of category = "LC_TIME". Sys.localeconv for details of numerical and monetary representations.
strptime用途category = "LC_TIME"。 Sys.localeconv数值和货币交涉的细节。
l10n_info gives some summary facts about the locale and its encoding.
l10n_info给有关的区域和它的编码总结了一些事实。
The "R Installation and Administration" manual for background on locales and how to find out locale names on your system.
“R安装和管理手册”为背景上的语言环境,以及如何找出您的系统上的语言环境名称。
举例----------Examples----------
Sys.getlocale()
Sys.getlocale("LC_TIME")
## Not run: [#无法运行:]
Sys.setlocale("LC_TIME", "de") # Solaris: details are OS-dependent[Solaris上:细节是依赖于操作系统的]
Sys.setlocale("LC_TIME", "de_DE.utf8") # Modern Linux etc.[现代的Linux等。]
Sys.setlocale("LC_TIME", "de_DE.UTF-8") # ditto[同上]
Sys.setlocale("LC_TIME", "de_DE") # Mac OS X, in UTF-8[Mac OS X中,在UTF-8]
Sys.setlocale("LC_TIME", "German") # Windows[窗口]
## End(Not run)[#结束(不运行)]
Sys.getlocale("LC_PAPER") # may or may not be set[可能会或可能不会被置]
Sys.setlocale("LC_COLLATE", "C") # turn off locale-specific sorting,[关闭区域设置特定的排序,]
# usually[平时]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|