- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个包含调用 fread
函数的包来自 data.table
。 data.table
在其 DESCRIPTION 文件的 Suggests 字段中包含 bit64
包,这使 fread
能够导入大整数作为integer64
而不是 numeric
。我的包中默认需要此功能。
这是一个可重现的例子,在 R 3.1.3 下(早期版本没有这个问题)。
Vectorize(dir.create)(c("test", "test/R", "test/man"))
cat(
"Package: test
Title: Test pkg
Description: Investigate how to use suggested package
Version: 0.0-1
Date: 2015-03-10
Author: Richie Cotton
Maintainer: Richie Cotton <a@b.com>
Imports: data.table
Suggests: bit64
License: Unlimited
",
file = "test/DESCRIPTION"
)
cat(
"#' Read data
#'
#' Wrapper to \\code{fread} that loads bit64 first
#' @param ... Passed to fread.
#' @return A data frame of uniformly distributed random numbers and their index.
#' @importFrom data.table fread
#' @export
read_data <- function(...)
{
library(bit64)
fread(...)
}",
file = "test/R/read_data.R"
)
当我运行 R CMD check
时,
library(roxygen2)
library(devtools)
roxygenize("test")
check("test")
我得到以下注意
:
* checking dependencies in R code ... NOTE
'library' or 'require' call to 'bit64' in package code.
Please use :: or requireNamespace() instead.
See section 'Suggested packages' in the 'Writing R Extensions' manual.
documentation建议将 library
替换为 requireNamespace
.这会检查包是否存在,但不会将其加载到 R 的搜索路径中。
如果我将 read_data
的定义更新为:
read_data <- function(...)
{
if(!requireNamespace('bit64'))
{
warning('bit64 not available.')
}
fread(...)
}
然后 R CMD check
运行顺利,但是由于 bit64
现在没有加载,fread
没有读取长整数的能力.
如果我更改 DESCRIPTION
以便 bit64
位于 Depends
部分(而不是 Suggests
,并且保持 read_data
与尝试 2 相同,或将其简化为
read_data <- function(...)
{
fread(...)
}
然后 R CMD check
给出 NOTE
:
* checking dependencies in R code ... NOTE
Package in Depends field not imported from: 'bit64'
These packages need to be imported from (in the NAMESPACE file)
for when this namespace is loaded but not attached.
我不太确定在这种情况下我应该导入什么。
如果我在Depends
部分保留bit64
,并使用read_data
的原始定义,
read_data <- function(...)
{
library(bit64)
fread(...)
}
然后 R CMD check
给出 NOTE
:
* checking dependencies in R code ... NOTE
'library' or 'require' call to 'bit64' which was already attached by Depends.
Please remove these calls from your code.
Package in Depends field not imported from: 'bit64'
我觉得应该有一些 DESCRIPTION
和函数定义的神奇组合,给我 bit64
功能并干净地通过 R CMD 检查
;我只是看不到我错过了什么。
我该怎么做?
最佳答案
尝试 3 最接近;我只需要在 roxygen 文档中添加一个额外的 @import bit64
。
Vectorize(dir.create)(c("test", "test/R", "test/man"))
cat(
"Package: test
Title: Test pkg
Description: Investigate how to use suggested package
Version: 0.0-1
Date: 2015-03-10
Author: Richie Cotton
Maintainer: Richie Cotton <a@b.com>
Depends: bit64
Imports: data.table
License: Unlimited
",
file = "test/DESCRIPTION"
)
cat(
"#' Read data
#'
#' Wrapper to \\code{fread} that loads bit64 first
#' @param ... Passed to fread.
#' @return A data frame of uniformly distributed random numbers and their index.
#' @import bit64
#' @importFrom data.table fread
#' @export
read_data <- function(...)
{
fread(...)
}",
file = "test/R/read_data.R"
)
关于r - 如何将 data.table::fread 包装在你自己的包中,具有 bit64 功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28961735/
是否可以在没有 bit.dev 帐户的情况下将 bit 设置为本地服务器以进行内部处理? 我知道您可能没有相同的功能 -- bit's FAQ page说“与 Bit CLI 不同,bit.dev 服
我是一名计算机科学学生,学习如何用 C 语言编程。我有 3 个文件和一个 Makefile。我有 logic.c logic.h main.c logic.c 的顶部是: #include "log
我有一个特殊的无符号长整型(32 位),我需要一点一点地转换它的字节序 - 我的长整型表示将多个内容混合在一起形成一个二进制文件。 我该怎么做? 最佳答案 字节顺序是一个字级概念,其中字节要么以最高有
我有许多 iOS Xcode 项目都使用同一个子项目。这个子项目构建一个静态库,然后链接到主项目。到目前为止,这个子项目和所有主项目都是 32 位的。 我想构建一个支持 64 位的新项目,因此将架构设
我创建了一个使用 SIMD 执行 64 位 * 64 位到 128 位的函数。目前我已经使用 SSE2(实际上是 SSE4.1)实现了它。这意味着它同时处理两个 64b*64b 到 128b 的产品。
想知道是否有人对我如何对二进制数执行以下操作有一些了解: 转换 01+0 -> 10+1 (+ as in regular expressions, one or more) 01 ->
代码如下: unsigned int v; // word value to compute the parity of v ^= v >> 16; v ^= v >> 8; v ^= v >> 4
我正在尝试在(测试版)Trackmania 2 游戏中制作脚本。(这是 JavaScript、HTML、C 和...其他我在最糟糕的噩梦中无法想象的东西的丑陋混合)。 脚本引擎似乎不知道“and”或“
这个问题在这里已经有了答案: How do AX, AH, AL map onto EAX? (6 个回答) 去年关闭。 所以,假设我正在使用寄存器 %rax和 %rdi . 作为一个基本的例子,让我
我是编程新手,来自非CS背景(没有正式学位)。我主要使用C#编写Winforms。 我对32位和64位感到困惑...。我的意思是,听说过32位OS,32位处理器以及基于程序的最大内存。它如何影响程序的
“清除整数的第 6 位”的最佳方法是什么? 而且,您的解决方案平台是否独立? (32 位或 64 位整数等)。如果没有,您能否提供一个独立于平台的解决方案? 更新: 我们不知道该位在给出时是已设置还是
我刚刚在交错一些 float 时发现了一些狡猾的问题。我简化了问题并尝试了一些测试 #include #include std::vector v; // global instance unio
我不想用这个来骚扰你,但我在互联网上的任何地方都找不到对“位填充”到底是什么的详细解释,也没有找到与位填充相关的线程的任何答案在 StackOverflow 上。 我还在 ISO 9899-1990
我有点卡住了,因为我找不到任何涵盖缓存“数据”部分的内容,我用谷歌搜索的所有内容都涉及 99.9% 的缓存寻址。我被问到的问题是这样措辞的 Contrast the difference betwee
关闭。这个问题需要debugging details .它目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and th
是否有人通过运行/附加到 64 位应用程序成功调试 64 位 dll?我有应用程序和 dll 的 Delphi 代码。我可以调试 32 位和 64 位应用程序。我还可以通过使用 Run -> Para
我有一些使用 native 组件的库,这些库是使用 NDK 为 32 位 Arm 架构构建的。 现在我们在现代设备上有 64 位处理器,所以我想知道这些库是否可以工作。在我的情况下,我没有本地库的源代
这是我上一个问题的延伸 - How to securely and efficiently store SSN in a database? 这个想法是,我想要安全地散列社会安全号码,然后插入到列中,
我很尴尬地说,我的数学技能很弱,而且我是一名自豪的计算机科学专业。我正在上课,这真是太令人难以承受了。这是我家庭作业的一部分,但是,在理解这一部分之前我无法继续。我类的每个人都在努力编写某种方法来完成
在 InnoSetup 中我运行这段代码: J32 := ShellExec('', 'java', '-d32 -version', '', SW_HIDE, ewWaitUntilTerminat
我是一名优秀的程序员,十分优秀!