English 中文(简体)
我如何使用@import 从那以后,它适用于整个R一揽子计划?
原标题:how do I use @importFrom so that it applies to a whole R package?

automated data analysis workflows I have the following code in my packagename.R file in the packagename folder.

我知道,我将经常利用其他一揽子计划的某些职能,因此,我想一劳永逸地把这些职能划出。 我认为,我应该能够采取上述做法,但我却不参加我的《国际理论》。

#  packagename: Package containing tools support project work.
# 
#  This package provides a central repository for methods to facilitate 
#  project work
#  @importFrom dplyr bind_rows mutate filter group_by ungroup
#  @importFrom purrr pluck map map_chr map_dbl
#  @importFrom lubridate ymd_hms
#  @importFrom odbc odbc
#  @importFrom DBI dbConnect dbDisconnect
#  @importFrom stringr str_detect str_replace_all
#  @docType package
#  @name packagename
NULL

在另一个档案中topic.R。 我有:

do_thing <- function(x) str_replace_all(x, " ", "_"))

当我打电话do_thing时,它告诉我:

Error in str_replace_all(x, " ", "_") : 
  could not find function "str_replace_all"

我是否需要增加一些东西,或者也许我做些什么?

根据对问题的评论,我需要先重新制定我的<条码>NAMESPACE,该编码显然是人工生成的(因为我开始使用国际宇宙航行联合会的项目),因此,<条码>。 不会更新。 我也有兴趣了解我如何能够从情报和安全局那里这样做。

这是我所建的菜::

“RStudio

我的<代码>NAMESPACE文档包括这些进口品,但我的测试稿在试图操作这些功能时仍然失败。 正如C. Braun所建议的那样,这是否是不可能的?

问题回答

这就是我如何做到:

#  @title External functions
# 
#  @description NA
# 
#  @rdname external_functions
#  @name external_functions
NULL
#  @rdname external_functions
#  @export
#  @importFrom lubridate ymd_hms
lubridate::ymd_hms

等等。





相关问题
How to plot fitted model over observed time series

This is a really really simple question to which I seem to be entirely unable to get a solution. I would like to do a scatter plot of an observed time series in R, and over this I want to plot the ...

REvolution for R

since the latest Ubuntu release (karmic koala), I noticed that the internal R package advertises on start-up the REvolution package. It seems to be a library collection for high-performance matrix ...

R - capturing elements of R output into text files

I am trying to run an analysis by invoking R through the command line as follows: R --no-save < SampleProgram.R > SampleProgram.opt For example, consider the simple R program below: mydata =...

R statistical package: wrapping GOFrame objects

I m trying to generate GOFrame objects to generate a gene ontology mapping in R for unsupported organisms (see http://www.bioconductor.org/packages/release/bioc/vignettes/GOstats/inst/doc/...

Changing the order of dodged bars in ggplot2 barplot

I have a dataframe df.all and I m plotting it in a bar plot with ggplot2 using the code below. I d like to make it so that the order of the dodged bars is flipped. That is, so that the bars labeled "...

Strange error when using sparse matrices and glmnet

I m getting a weird error when training a glmnet regression. invalid class "dgCMatrix" object: length(Dimnames[[2]]) must match Dim[2] It only happens occasionally, and perhaps only under larger ...

Generating non-duplicate combination pairs in R

Sorry for the non-descriptive title but I don t know whether there s a word for what I m trying to achieve. Let s assume that I have a list of names of different classes like c( 1 , 2 , 3 , 4 ) ...

Per panel smoothing in ggplot2

I m plotting a group of curves, using facet in ggplot2. I d like to have a smoother applied to plots where there are enough points to smooth, but not on plots with very few points. In particular I d ...

热门标签