【文件属性】:
文件名称:typed:R的静态键入
文件大小:277KB
文件格式:ZIP
更新时间:2021-03-13 12:09:48
R
打字
{typed}为R实现类型系统,它具有3个主要功能:
在脚本或函数主体中设置变量类型,因此不能为它们分配非法值
在函数定义中设置参数类型
设置函数的返回类型
用户可以定义自己的类型,也可以利用其他程序包中的断言。
在幕后,变量类型使用主动绑定,因此一旦变量受断言限制,就不能以不满足要求的方式对其进行修改。
安装
安装方式:
remotes :: install_github( " moodymudskipper/typed " )
并附上:
# masking warning about overriding `?`
library( typed , warn.conflicts = FALSE )
设置变量类型
问号符号并declare
以下是有关如何设置类型的示例
Character() ? x # restrict x to "character" type
x
【文件预览】:
typed-master
----.travis.yml(158B)
----docs()
--------apple-touch-icon-60x60.png(4KB)
--------bootstrap-toc.css(2KB)
--------bootstrap-toc.js(5KB)
--------docsearch.css(11KB)
--------404.html(5KB)
--------apple-touch-icon.png(15KB)
--------pkgdown.css(7KB)
--------apple-touch-icon-76x76.png(5KB)
--------apple-touch-icon-152x152.png(12KB)
--------index.html(33KB)
--------favicon-32x32.png(2KB)
--------apple-touch-icon-120x120.png(9KB)
--------authors.html(5KB)
--------link.svg(810B)
--------pkgdown.yml(88B)
--------reference()
--------favicon-16x16.png(1KB)
--------logo.png(25KB)
--------docsearch.js(2KB)
--------favicon.ico(15KB)
--------apple-touch-icon-180x180.png(15KB)
--------pkgdown.js(3KB)
----README.Rmd(9KB)
----man()
--------figures()
--------process_assertion_factory_dots.Rd(364B)
--------static_typing.Rd(1KB)
--------get_assertion.Rd(306B)
--------as_assertion_factory.Rd(276B)
--------assertion_factories.Rd(4KB)
----pkgdown()
--------favicon()
----NAMESPACE(596B)
----tests()
--------testthat()
--------testthat.R(54B)
----.Rbuildignore(76B)
----codecov.yml(232B)
----.gitignore(29B)
----R()
--------01_question_mark.R(9KB)
--------05_new_type.R(4KB)
--------02_declare.R(6KB)
--------06_native_types.R(20KB)
--------04_print.R(517B)
----DESCRIPTION(633B)
----typed.Rproj(414B)
----README.md(12KB)