Open chrisvwn opened 3 years ago
Are you sure in your pkg you import ff in the namespace. We have https://github.com/edwindj/ffbase/blob/ec716c9d5a62e2741cdcbd9b89984fc08dcee14c/pkg/R/pkg.R#L72
Explicitely mentioning .rambytes. I don't see ffbase or ff mentioned in your pkg namespace on github
I see what you mean. I haven't had to explicitly import either ff or ffbase before which is why I raised this. Only data.table
and %dopar%
from foreach
are imported in the pkg namespace because I could not find a way to use them without doing so.
I can go ahead and import ffbase and ff if this is not an issue. I just thought it was neat being able to get full pkg functionality without attaching the package.
.rambytes is defined here in ff: https://github.com/truecluster/ff/blob/8d109d251c15bc49618cf479f69029a5093aef5a/R/vmode.R#L416
Please test your package by adding something like (if you use roxygen2)
#' @importFrom .rambytes
I am using roxygen2 so I will use the @importFrom
if necessary. I think it would be #' @importFrom ff .rambytes
.
But at the risk of belaboring the point, I was thinking this is something that can be altered at source. Shouldn't it be possible to simply run the following code without having to import or attach any packages/resources?
x <- ff::ff(initdata = 1:10, finalizer = "delete", overwrite = T)
x <- ffbase::ffappend(x, 11:20, adjustvmode = T)
I get the same error when I run this.
I am not an expert at this but would it maybe make sense to maybe use ff::.rambytes
or something similar rather than get(".rambytes")
since it specifies where to look for the resource even if pkg ff is not attached?
yes, you're right
I can confirm this. In my case however I get the following error additionally (after importing .rambytes
) to the package:
Error in get("vmode") : object 'vmode' not found
traceback:
7: get("vmode")
6: chunk.default(y)
5: chunk(y)
4: ffappend(fltr, a)
3: ffwhich.ffdf(x, ss, envir = parent.frame())
sessionInfo():
R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux bullseye/sid
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_IL.utf8 LC_COLLATE=en_IL.utf8
[5] LC_MONETARY=en_IL.utf8 LC_MESSAGES=en_IL.utf8
[7] LC_PAPER=en_IL.utf8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_IL.utf8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] covidAgeData_0.0.3
loaded via a namespace (and not attached):
[1] RcppEigen_0.3.3.9.1 tidyselect_1.1.0 xfun_0.19
[4] ffbase_0.13.1 remotes_2.2.0 purrr_0.3.4
[7] lattice_0.20-41 vctrs_0.3.6 generics_0.1.0
[10] testthat_3.0.1 usethis_2.0.0 rlang_0.4.10
[13] pkgbuild_1.2.0 pillar_1.4.7 httpcode_0.3.0
[16] glue_1.4.2 withr_2.3.0 sessioninfo_1.1.1
[19] lifecycle_0.2.0 stringr_1.4.0 commonmark_1.7
[22] devtools_2.3.2 memoise_1.1.0 knitr_1.30
[25] RcppArmadillo_0.10.1.2.0 ff_4.0.4 callr_3.5.1
[28] ps_1.5.0 curl_4.3 parallel_4.0.3
[31] fansi_0.4.1 Rcpp_1.0.5 osfr_0.2.8
[34] desc_1.2.0 pkgload_1.1.0 jsonlite_1.7.2
[37] fs_1.5.0 bit_4.0.4 fastmatch_1.1-0
[40] digest_0.6.27 stringi_1.5.3 processx_3.4.5
[43] dplyr_1.0.2 collapse_1.5.0 rprojroot_2.0.2
[46] grid_4.0.3 cli_2.2.0 tools_4.0.3
[49] magrittr_2.0.1 tibble_3.0.4 crul_1.0.0
[52] crayon_1.3.4 pkgconfig_2.0.3 ellipsis_0.3.1
[55] Matrix_1.3-0 xml2_1.3.2 data.table_1.13.6
[58] prettyunits_1.1.1 assertthat_0.2.1 httr_1.4.2
[61] roxygen2_7.1.1 rstudioapi_0.13 R6_2.5.0
[64] compiler_4.0.3
Importing vmode
as well as .rambytes
to my package "fixes" this issue. But we shouldn't have to import anything.
@eshom How are you importing vmode
and .rambytes
? When I import only .rambytes
it gives the error about vmode not found
. But when I import both it complains about .rambytes not found
again. I cannot seem to get the imports to work.
What I have at the function that uses ffbase
:
#' @importFrom ff vmode .rambytes
@chrisvwn
That's how I import as well: #' @importFrom ff .rambytes vmode
Thanks. For some reason it won't work on mine.
Hi,
I am getting the error:
when I use the
ffbase::ffappend
function within the packageRnightlights
.The relevant part of the traceback when this happens is:
rastVals
is anumeric vector
andvals
is anff_vector
.My sessionInfo:
get(".rambytes")
seems to work when I load the ff package explicitly vialibrary()
.Not sure if I should post this here or on the ff package page.