- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
开始创建一个包,我构建了一些函数,然后运行 devtools::check() 以确保我步入正轨。下面我复制了 devtools::check() 命令的整个输出。有两个注释让我感到惊讶。我希望通过清理这两件事,其他事情变得更容易修复,所以我从它们开始。我并不是想解决检查中的所有问题,只是想理解这两个问题。第一个是:
File LICENSE is not mentioned in the DESCRIPTION file
另一个在后面
checking R code for possible problems (3.7s)
其中有许多消息“没有可见的全局函数定义”,尽管这些函数位于在描述文件中导入的包中。
以下是描述文件。完整的可重现代码可以在 https://github.com/rexmacey/factorModel 中找到。 。之后是 devtools::check 命令的输出。
Package: factorModel
Title: Factor Model Creation and Evaluation
Version: 0.0.0.9000
Authors@R: person("Rex", "Macey", email = "rex@macey.us", role = c("aut", "cre"))
Description: Creates and tests factor models.
Depends: R (>= 3.5.0)
License: GPL-2
Encoding: UTF-8
LazyData: true
Imports:
dplyr,
knitr,
lubridate,
ggplot2,
reshape2,
tidyquant
Suggests:
utils,
testthat
VignetteBuilder:
utils
RoxygenNote: 6.1.1
devtools::check 的输出
> check()
Updating factorModel documentation
Writing NAMESPACE
Loading factorModel
Writing NAMESPACE
-- Building -------------------------------------------------------------- factorModel --
Setting env vars:
* CFLAGS : -Wall -pedantic
* CXXFLAGS : -Wall -pedantic
* CXX11FLAGS: -Wall -pedantic
-----------------------------------------------------------------------------------------
√ checking for file 'C:\Users\Rex\Google Drive\RedTortoise\Research - RT\factorModel/DESCRIPTION' (449ms)
- preparing 'factorModel': (441ms)
√ checking DESCRIPTION meta-information ...
- excluding invalid files
Subdirectory 'R' contains invalid file names:
'desktop.ini'
Subdirectory 'man' contains invalid file names:
'desktop.ini'
- checking for LF line-endings in source and make files and shell scripts
- checking for empty or unneeded directories
- looking to see if a 'data/datalist' file should be added
- building 'factorModel_0.0.0.9000.tar.gz'
-- Checking -------------------------------------------------------------- factorModel --
Setting env vars:
* _R_CHECK_CRAN_INCOMING_REMOTE_: FALSE
* _R_CHECK_CRAN_INCOMING_ : FALSE
* _R_CHECK_FORCE_SUGGESTS_ : FALSE
-- R CMD check --------------------------------------------------------------------------
- using log directory 'C:/Users/Rex/AppData/Local/Temp/Rtmp4ig3Oj/factorModel.Rcheck' (400ms)
- using R version 3.5.1 (2018-07-02)
- using platform: x86_64-w64-mingw32 (64-bit)
- using session charset: ISO8859-1
- using options '--no-manual --as-cran'
√ checking for file 'factorModel/DESCRIPTION'
- this is package 'factorModel' version '0.0.0.9000'
- package encoding: UTF-8
√ checking package namespace information
√ checking package dependencies (952ms)
√ checking if this is a source package ...
√ checking if there is a namespace
√ checking for .dll and .exe files
√ checking for hidden files and directories ...
√ checking for portable file names ...
√ checking whether package 'factorModel' can be installed (5.1s)
√ checking package directory (767ms)
√ checking DESCRIPTION meta-information (644ms)
N checking top-level files
File
LICENSE
is not mentioned in the DESCRIPTION file.
√ checking for left-over files ...
√ checking index information
√ checking package subdirectories ...
√ checking R files for non-ASCII characters ...
√ checking R files for syntax errors ...
√ checking whether the package can be loaded ...
√ checking whether the package can be loaded with stated dependencies ...
√ checking whether the package can be unloaded cleanly ...
√ checking whether the namespace can be loaded with stated dependencies ...
√ checking whether the namespace can be unloaded cleanly (521ms)
√ checking loading without being on the library search path (697ms)
√ checking dependencies in R code ...
√ checking S3 generic/method consistency (609ms)
√ checking replacement functions ...
√ checking foreign function calls ...
N checking R code for possible problems (3.6s)
AddFactor: no visible global function definition for '%>%'
AddFactor: no visible global function definition for 'filter'
GetFundReturns: no visible global function definition for '%>%'
GetFundReturns: no visible global function definition for 'tq_get'
GetFundReturns: no visible global function definition for '%m+%'
GetFundReturns: no visible global function definition for 'days'
GetFundReturns: no visible global function definition for 'group_by'
GetFundReturns: no visible binding for global variable 'symbol'
GetFundReturns: no visible global function definition for
'tq_transmute'
GetFundReturns: no visible binding for global variable 'adjusted'
GetFundReturns: no visible binding for global variable 'periodReturn'
GetFundReturns: no visible global function definition for 'filter'
plot_corr: no visible global function definition for 'cor'
plot_corr: no visible global function definition for 'melt'
plot_corr: no visible global function definition for 'ggplot'
plot_corr: no visible global function definition for 'aes'
plot_corr: no visible binding for global variable 'Var2'
plot_corr: no visible binding for global variable 'Var1'
plot_corr: no visible binding for global variable 'value'
plot_corr: no visible global function definition for 'geom_tile'
plot_corr: no visible global function definition for
'scale_fill_gradient2'
plot_corr: no visible global function definition for 'theme_minimal'
plot_corr: no visible global function definition for 'theme'
plot_corr: no visible global function definition for 'element_text'
plot_corr: no visible global function definition for 'coord_fixed'
plot_corr: no visible global function definition for 'xlab'
plot_corr: no visible global function definition for 'ylab'
plot_corr: no visible global function definition for 'geom_text'
plot_corr: no visible global function definition for 'element_blank'
plot_corr: no visible global function definition for 'guides'
plot_corr: no visible global function definition for 'guide_colorbar'
Undefined global functions or variables:
%>% %m+% Var1 Var2 adjusted aes coord_fixed cor days element_blank
element_text filter geom_text geom_tile ggplot group_by
guide_colorbar guides melt periodReturn scale_fill_gradient2 symbol
theme theme_minimal tq_get tq_transmute value xlab ylab
Consider adding
importFrom("stats", "cor", "filter")
to your NAMESPACE file.
Found the following calls to data() loading into the global environment:
File 'factorModel/R/loadLibraries.r':
data(factorReturns)
data("factorReturns.US")
data(factorReturns.Intl)
data(factorReturns.EM)
data("factorGroups")
See section 'Good practice' in '?data'.
√ checking Rd files ...
√ checking Rd metadata ...
√ checking Rd line widths ...
√ checking Rd cross-references ...
√ checking for missing documentation entries ...
√ checking for code/documentation mismatches (730ms)
√ checking Rd \usage sections (816ms)
√ checking Rd contents ...
√ checking for unstated dependencies in examples ...
W checking contents of 'data' directory ...
Files not of a type allowed in a 'data' directory:
'desktop.ini'
Please use e.g. 'inst/extdata' for non-R data files
√ checking data for non-ASCII characters ...
√ checking data for ASCII and uncompressed saves ...
E checking examples (653ms)
Running examples in 'factorModel-Ex.R' failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: AddFactor
> ### Title: Add a Factor
> ### Aliases: AddFactor
>
> ### ** Examples
>
> AddFactor(factorReturns=factorReturns.US, newFactorReturns=newFactorReturns, calcExcess=TRUE)
Error in FindMaxCommonDateRange(factorReturns$date, newFactorReturns$date) :
object 'newFactorReturns' not found
Calls: AddFactor -> FindMaxCommonDateRange
Execution halted
√ checking for unstated dependencies in 'tests' ...
- checking tests ...
E Running 'testthat.R'
Running the tests in 'tests/testthat.R' failed.
Last 13 lines of output:
5: eval(quote(`_fseq`(`_lhs`)), env, env)
6: `_fseq`(`_lhs`)
7: freduce(value, `_function_list`)
8: withVisible(function_list[[k]](value))
9: function_list[[k]](value)
10: filter(., date >= dateRange["start"] & date <= dateRange["end"])
11: Ops.Date(date, dateRange["start"])
12: NextMethod(.Generic)
== testthat results ===========================================================
OK: 0 SKIPPED: 0 FAILED: 1
1. Error: AddFactor adds a column, restricts dates (@test_AddFactor.r#9)
Error: testthat unit tests failed
Execution halted
See
'C:/Users/Rex/AppData/Local/Temp/Rtmp4ig3Oj/factorModel.Rcheck/00check.log'
for details.
-- R CMD check results -------------------------------------- factorModel 0.0.0.9000 ----
Duration: 22.1s
> checking examples ... ERROR
Running examples in 'factorModel-Ex.R' failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: AddFactor
> ### Title: Add a Factor
> ### Aliases: AddFactor
>
> ### ** Examples
>
> AddFactor(factorReturns=factorReturns.US, newFactorReturns=newFactorReturns, calcExcess=TRUE)
Error in FindMaxCommonDateRange(factorReturns$date, newFactorReturns$date) :
object 'newFactorReturns' not found
Calls: AddFactor -> FindMaxCommonDateRange
Execution halted
> checking tests ...
See below...
> checking contents of 'data' directory ... WARNING
Files not of a type allowed in a 'data' directory:
'desktop.ini'
Please use e.g. 'inst/extdata' for non-R data files
> checking top-level files ... NOTE
File
LICENSE
is not mentioned in the DESCRIPTION file.
> checking R code for possible problems ... NOTE
AddFactor: no visible global function definition for '%>%'
AddFactor: no visible global function definition for 'filter'
GetFundReturns: no visible global function definition for '%>%'
GetFundReturns: no visible global function definition for 'tq_get'
GetFundReturns: no visible global function definition for '%m+%'
GetFundReturns: no visible global function definition for 'days'
GetFundReturns: no visible global function definition for 'group_by'
GetFundReturns: no visible binding for global variable 'symbol'
GetFundReturns: no visible global function definition for
'tq_transmute'
GetFundReturns: no visible binding for global variable 'adjusted'
GetFundReturns: no visible binding for global variable 'periodReturn'
GetFundReturns: no visible global function definition for 'filter'
plot_corr: no visible global function definition for 'cor'
plot_corr: no visible global function definition for 'melt'
plot_corr: no visible global function definition for 'ggplot'
plot_corr: no visible global function definition for 'aes'
plot_corr: no visible binding for global variable 'Var2'
plot_corr: no visible binding for global variable 'Var1'
plot_corr: no visible binding for global variable 'value'
plot_corr: no visible global function definition for 'geom_tile'
plot_corr: no visible global function definition for
'scale_fill_gradient2'
plot_corr: no visible global function definition for 'theme_minimal'
plot_corr: no visible global function definition for 'theme'
plot_corr: no visible global function definition for 'element_text'
plot_corr: no visible global function definition for 'coord_fixed'
plot_corr: no visible global function definition for 'xlab'
plot_corr: no visible global function definition for 'ylab'
plot_corr: no visible global function definition for 'geom_text'
plot_corr: no visible global function definition for 'element_blank'
plot_corr: no visible global function definition for 'guides'
plot_corr: no visible global function definition for 'guide_colorbar'
Undefined global functions or variables:
%>% %m+% Var1 Var2 adjusted aes coord_fixed cor days element_blank
element_text filter geom_text geom_tile ggplot group_by
guide_colorbar guides melt periodReturn scale_fill_gradient2 symbol
theme theme_minimal tq_get tq_transmute value xlab ylab
Consider adding
importFrom("stats", "cor", "filter")
to your NAMESPACE file.
Found the following calls to data() loading into the global environment:
File 'factorModel/R/loadLibraries.r':
data(factorReturns)
data("factorReturns.US")
data(factorReturns.Intl)
data(factorReturns.EM)
data("factorGroups")
See section 'Good practice' in '?data'.
-- Test failures ---------------------------------------------------------- testthat ----
> library(testthat)
> library(factorModel)
>
> test_check("factorModel")
-- 1. Error: AddFactor adds a column, restricts dates (@test_AddFactor.r#9) --
comparison (5) is possible only for atomic and list types
1: AddFactor(fr1, fr2, TRUE) at testthat/test_AddFactor.r:9
2: factorReturns %>% filter(date >= dateRange["start"] & date <= dateRange["end"])
3: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
4: eval(quote(`_fseq`(`_lhs`)), env, env)
5: eval(quote(`_fseq`(`_lhs`)), env, env)
6: `_fseq`(`_lhs`)
7: freduce(value, `_function_list`)
8: withVisible(function_list[[k]](value))
9: function_list[[k]](value)
10: filter(., date >= dateRange["start"] & date <= dateRange["end"])
11: Ops.Date(date, dateRange["start"])
12: NextMethod(.Generic)
== testthat results ===========================================================
OK: 0 SKIPPED: 0 FAILED: 1
1. Error: AddFactor adds a column, restricts dates (@test_AddFactor.r#9)
Error: testthat unit tests failed
Execution halted
2 errors x | 1 warning x | 2 notes x
最佳答案
你一定想看看这本书R packages作者:哈德利·威克姆。他还有一章关于 Checking .
由于“未提及许可证”而去掉注释,您应该将 License: GPL-3
更改为 License: GPL-3 + file LICENSE
(另请参见 http://r-pkgs.had.co.nz/description.html#license )。或者您应该删除文件 LICENSE。
关于没有可见的全局函数定义
,您需要定义函数的来源。它们要么由您在包中定义。或者它们需要进口。例如,要从 dplyr 导入 group_by()
,您需要执行以下操作(另请参阅 http://r-pkgs.had.co.nz/namespace.html#imports ):
在描述文件中列出 dplyr(例如,在“导入”下)
通过任一方式导入 group_by()
group_by()
替换为 dplyr::group_by()
,或者@importFrom dplyr group_by
导入函数。这些是最重要的选项,您可以在 http://r-pkgs.had.co.nz/namespace.html 中阅读。 .
关于R devtools::check LICENSE 未提及以及描述文件中的其他问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56102225/
在一个环境中,我有 pandas 版本 0.17.0 和 numpy 版本 1.10.1。在另一个环境中,我有 pandas 版本 0.18.1 和 numpy 版本 1.10.4。 我运行这段代码
This question already has answers here: Default stringify for objects, equivalent to Java's toString
我一直在尝试为我的profile命令嵌入设置一个人们可以更改的简历。我认为它应该有效,但我的代码似乎有问题。 相关代码如下: const PREFIX = '!'; var bio = {}; cli
我正在尝试获取网站图标、网站标题和外部 URL 列表的描述,最好使用 jquery。我已经成功地为我的网址同步了谷歌的图标服务,任何人都可以阐明如何实现网站标题和描述吗?这是我到目前为止获得图标的内容
我在尝试运行代码时收到错误。找不到问题出在哪里。我可能遗漏了一些小细节,如果您能纠正它那就太好了。 计算Servlet import java.io.IOException; impo
我的数据库中有两个字段,一个是描述(TEXT),另一个是short_desc(VARCHAR-200)。 当我显示搜索结果时,我显然使用了short_desc,当有人点击该项目时,他们会得到完整的描述
当我尝试通过ajax和Jquery调用 Controller 上的save方法时,我正在使用Spring MVC、Jquery、Hibernate和tomcat。单击“保存”按钮时,我在 tomcat
我试图使用describe()来获取一些描述性统计数据,但获取了应该是数字的nan值。 我尝试使用 axis=0 或 axis=1,而 axis=1 产生了正确的数值,但这不是正确的数值我需要; ax
我有超过 1 亿个字符串要存储在文件系统中。与字符串 (~255Chars utf8) 一起,将有两个日期和一些定义其属性的整数值。 我可以将它们放在一个 CSV 文件中,但它会很大。我可以将几个较小
有没有办法将 JavaScript 合并到 Jenkins 顶部的描述字段中? 每当我添加脚本标签时,当您查看源代码时,它都会被 Jenkins 删除。 如果有人有建议或方向指出我,那就太好了。
您如何获得 SEH 的名称和/或描述?异常无需必须将字符串硬编码到您的应用程序中? 我尝试使用 FormatMessage(),但它有时会截断消息,即使您指定忽略插入也是如此: __asm { //
如果我在 MySQL 中使用 CREATE TRIGGER 语法创建一个触发器,我该如何附加注释来描述它?我的意思是在声明中或之后对我来说是一样的。 我想不通。对于表格,您可以在声明末尾添加 COMM
关闭。这个问题是opinion-based .它目前不接受答案。 想要改进这个问题? 更新问题,以便 editing this post 可以用事实和引用来回答它. 关闭 8 年前。 Improve
当开发多媒体应用或者游戏应用的时候,需要使用音量控制键来设置程序的音量大小。在Android系统中有多中音频流,通过Activity中的函数 setVolumeControlStream(int s
Slick DSL 允许通过两种方式在表中创建可选字段。 对于这个案例类: case class User(id: Option[Long] = None, fname: String, lname:
如果不属于默认命名空间,我如何描述 pod 信息。使用默认命名空间我没有任何问题。 但我想获得与命名空间对齐的特定 pod 的信息。 但是,当我想描述我可以制作的同一个 pod 时,请参阅 我尝试使用
在我使用过的几乎所有 vim 副本中,程序都会在替换文本后给出更改的描述。 (例如,将显示类似“20 行 92 个替换”之类的内容。) 我现在正在使用默认情况下不这样做的 vim 副本。 是否有一个简
我正在编写规范,需要描述一些 JSON 对象。单独的文本和选项卡往往会使大型 JSON 变得过于困惑。是否有任何在线(最好)工具可以创建类似于 http://www.json.org/ 上的图表的工具
我正在尝试通过 DNS 将我的 Kubernetes 部署连接在一起。 我有一个 Java (Spring Boot) 部署和一个 javascript (node.js) 部署,两者都通过默认的 C
我只是在学习 WebGL 图形编程。 我正在检查包含该语句的某人的代码 // multiply the position by the matrix. gl_Position = vec4((u_ma
我是一名优秀的程序员,十分优秀!