Hello,
I?m having some issues in interpreting BiocCheck outputs, maybe someone can tell me how to fix the issues.
I?ve got 2 main issues that cause the check to fail after normal CRAN check has passed:
1. I get this error message
* Checking if other packages can import this one...
* ERROR: Packages providing 2 object(s) used in this package should be imported in the NAMESPACE file, otherwise packages importing
this package may fail.
However it is nowhere mentioned which packages they are and where those objects are instantiated so I have no clue how to solve this one
1. Since previous version of the package, which built and passed checks without issues, I?ve been using a custom *.Rmd file placed in inst/rmd in the vignette to recycle the same chunk of code and optimizing time in phase of update (I update info only once instead of 4 times). Even if the package passes CRAN checks, BiocCheck errors telling me it can?t find this Rmd file and therefore can?t evaluate the chunk where it is mentioned. Any suggestion on this?
Thanks in advance
Giulia
[Bioc-devel] Interpreting BiocCheck output
8 messages · Marcel Ramos, Giulia Pais, Martin Morgan +3 more
1 day later
Hi Giulia, Are you using a recent version of BiocCheck? If so, check the bottom of the BiocCheck::BiocCheck(): --- See the <packageName>.BiocCheck folder and run ??? browseVignettes(package = 'BiocCheck') for details. --- Can you provide more details, e.g., the repository of the package? Thanks. Best regards, Marcel
On 10/4/22 4:44 AM, Giulia Pais wrote:
Hello,
I?m having some issues in interpreting BiocCheck outputs, maybe someone can tell me how to fix the issues.
I?ve got 2 main issues that cause the check to fail after normal CRAN check has passed:
1. I get this error message
* Checking if other packages can import this one...
* ERROR: Packages providing 2 object(s) used in this package should be imported in the NAMESPACE file, otherwise packages importing
this package may fail.
However it is nowhere mentioned which packages they are and where those objects are instantiated so I have no clue how to solve this one
1. Since previous version of the package, which built and passed checks without issues, I?ve been using a custom *.Rmd file placed in inst/rmd in the vignette to recycle the same chunk of code and optimizing time in phase of update (I update info only once instead of 4 times). Even if the package passes CRAN checks, BiocCheck errors telling me it can?t find this Rmd file and therefore can?t evaluate the chunk where it is mentioned. Any suggestion on this?
Thanks in advance
Giulia
[[alternative HTML version deleted]]
_______________________________________________ Bioc-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel
This email message may contain legally privileged and/or...{{dropped:2}}
Hi, thanks for the reply. I managed to fix the first error as it was a minor issue in the code, while for the second one I don?t have a solution since the problem appears only locally and not on Biconductor after the build.
Just for reference the package is ISAnalytics and the BiocCheck version is the latest one.
Thanks again,
Giulia
From: Bioc-devel <bioc-devel-bounces at r-project.org> on behalf of Marcel Ramos <marcel.ramosperez at roswellpark.org>
Date: Wednesday, 2022October5 at 23:48
To: bioc-devel at r-project.org <bioc-devel at r-project.org>
Subject: Re: [Bioc-devel] EXTERNAL: Interpreting BiocCheck output
Hi Giulia,
Are you using a recent version of BiocCheck?
If so, check the bottom of the BiocCheck::BiocCheck():
---
See the <packageName>.BiocCheck folder and run
browseVignettes(package = 'BiocCheck')
for details.
---
Can you provide more details, e.g., the repository of the package?
Thanks.
Best regards,
Marcel
On 10/4/22 4:44 AM, Giulia Pais wrote:
Hello,
I?m having some issues in interpreting BiocCheck outputs, maybe someone can tell me how to fix the issues.
I?ve got 2 main issues that cause the check to fail after normal CRAN check has passed:
1. I get this error message
* Checking if other packages can import this one...
* ERROR: Packages providing 2 object(s) used in this package should be imported in the NAMESPACE file, otherwise packages importing
this package may fail.
However it is nowhere mentioned which packages they are and where those objects are instantiated so I have no clue how to solve this one
1. Since previous version of the package, which built and passed checks without issues, I?ve been using a custom *.Rmd file placed in inst/rmd in the vignette to recycle the same chunk of code and optimizing time in phase of update (I update info only once instead of 4 times). Even if the package passes CRAN checks, BiocCheck errors telling me it can?t find this Rmd file and therefore can?t evaluate the chunk where it is mentioned. Any suggestion on this?
Thanks in advance
Giulia
[[alternative HTML version deleted]]
_______________________________________________ Bioc-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel
This email message may contain legally privileged and/or...{{dropped:2}}
_______________________________________________
Bioc-devel at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel
1 day later
Hi Giulia, Thanks for sharing. I took a look at https://github.com/calabrialab/ISAnalytics and I'm glad you resolved the issue. Just a reminder, you can also use `utils::globalVariables('.')` in your package for functions that use `'.'` (and other symbols) as a variable, e.g. in `purrr::pmap`. Best regards, Marcel
On 10/6/22 4:34 AM, Giulia Pais wrote:
Hi, thanks for the reply. I managed to fix the first error as it was a minor issue in the code, while for the second one I don?t have a solution since the problem appears only locally and not on Biconductor after the build. Just for reference the package is ISAnalytics and the BiocCheck version is the latest one. Thanks again, Giulia *From: *Bioc-devel <bioc-devel-bounces at r-project.org> on behalf of Marcel Ramos <marcel.ramosperez at roswellpark.org> *Date: *Wednesday, 2022October5 at 23:48 *To: *bioc-devel at r-project.org <bioc-devel at r-project.org> *Subject: *Re: [Bioc-devel] EXTERNAL: Interpreting BiocCheck output Hi Giulia, Are you using a recent version of BiocCheck? If so, check the bottom of the BiocCheck::BiocCheck(): --- See the <packageName>.BiocCheck folder and run ???? browseVignettes(package = 'BiocCheck') for details. --- Can you provide more details, e.g., the repository of the package? Thanks. Best regards, Marcel On 10/4/22 4:44 AM, Giulia Pais wrote:
Hello, I?m having some issues in interpreting BiocCheck outputs, maybe
someone can tell me how to fix the issues.
I?ve got 2 main issues that cause the check to fail after normal
CRAN check has passed:
??? 1.? I get this error message * Checking if other packages can import this one... ????? * ERROR: Packages providing 2 object(s) used in this package
should be imported in the NAMESPACE file, otherwise packages importing
??????? this package may fail. However it is nowhere mentioned which packages they are and where
those objects are instantiated so I have no clue how to solve this one
??? 1.? Since previous version of the package, which built and passed
checks without issues, I?ve been using a custom *.Rmd file placed in inst/rmd in the vignette to recycle the same chunk of code and optimizing time in phase of update (I update info only once instead of 4 times). Even if the package passes CRAN checks, BiocCheck errors telling me it can?t find this Rmd file and therefore can?t evaluate the chunk where it is mentioned. Any suggestion on this?
Thanks in advance Giulia ??????? [[alternative HTML version deleted]]
_______________________________________________ Bioc-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel
<https://secure-web.cisco.com/1BHJN2d_YaqvKQMHULUaRH7QNYQJdOhBmii2EQbiAbqa5Lkeb8i3hiUIfaWofD4P7qtrIBd4DMzICkiL7nxBM9QffrsbPxL3_kbkQFAg-yuAopFfphrSrtxM2B2Z0qp-DcUG2pechJ5QE0wfC6p5VsjrRr4nhPCl3WjsqZcBETYfmUItDeY_Br3CVecmoCk5k1gglA7riYZaVCfjP1NsjpliHO07urMoNlQIYYEyGXtdcZP0VSYaKiMgyYU41JtU_ZqKBSRUTtRknaIU5cZSeS6gHT4j4gobUCm1A0EVQToHkI-c8MgdgesyootE6ZRVht1uNPHivzeujJGoWsZJUQA/https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fbioc-devel> This email message may contain legally privileged and/or...{{dropped:2}}
_______________________________________________ Bioc-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel <https://secure-web.cisco.com/1BHJN2d_YaqvKQMHULUaRH7QNYQJdOhBmii2EQbiAbqa5Lkeb8i3hiUIfaWofD4P7qtrIBd4DMzICkiL7nxBM9QffrsbPxL3_kbkQFAg-yuAopFfphrSrtxM2B2Z0qp-DcUG2pechJ5QE0wfC6p5VsjrRr4nhPCl3WjsqZcBETYfmUItDeY_Br3CVecmoCk5k1gglA7riYZaVCfjP1NsjpliHO07urMoNlQIYYEyGXtdcZP0VSYaKiMgyYU41JtU_ZqKBSRUTtRknaIU5cZSeS6gHT4j4gobUCm1A0EVQToHkI-c8MgdgesyootE6ZRVht1uNPHivzeujJGoWsZJUQA/https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fbioc-devel>
This email message may contain legally privileged and/or...{{dropped:4}}
Just my two cents, but I don?t think using `globalVariables()` is a good idea in a package ? it?s too easy to say that R should ignore a variable that it should not. In the context of dplyr, the alternative is to `importFrom dplyr .data` or to use ?standard? evaluation, depending on circumstance
mtcars |> as_tibble() |> filter(.data$mpg > 30) # .data is imported, so known?
# A tibble: 4 ? 11
mpg cyl disp hp drat wt qsec vs am gear carb
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 32.4 4 78.7 66 4.08 2.2 19.5 1 1 4 1
2 30.4 4 75.7 52 4.93 1.62 18.5 1 1 4 2
3 33.9 4 71.1 65 4.22 1.84 19.9 1 1 4 1
4 30.4 4 95.1 113 3.77 1.51 16.9 1 1 5 2
mtcars |> select("mpg", "cyl") |> head(3) # `?mpg?` and `?cyl?` are character vectors, not symbols?
mpg cyl Mazda RX4 21.0 6 Mazda RX4 Wag 21.0 6 Datsun 710 22.8 4 Martin From: Bioc-devel <bioc-devel-bounces at r-project.org> on behalf of Marcel Ramos <marcel.ramosperez at roswellpark.org> Date: Friday, October 7, 2022 at 3:07 PM To: bioc-devel at r-project.org <bioc-devel at r-project.org> Subject: Re: [Bioc-devel] Interpreting BiocCheck output Hi Giulia, Thanks for sharing. I took a look at https://github.com/calabrialab/ISAnalytics and I'm glad you resolved the issue. Just a reminder, you can also use `utils::globalVariables('.')` in your package for functions that use `'.'` (and other symbols) as a variable, e.g. in `purrr::pmap`. Best regards, Marcel
On 10/6/22 4:34 AM, Giulia Pais wrote:
Hi, thanks for the reply. I managed to fix the first error as it was a
minor issue in the code, while for the second one I don?t have a
solution since the problem appears only locally and not on Biconductor
after the build.
Just for reference the package is ISAnalytics and the BiocCheck
version is the latest one.
Thanks again,
Giulia
*From: *Bioc-devel <bioc-devel-bounces at r-project.org> on behalf of
Marcel Ramos <marcel.ramosperez at roswellpark.org>
*Date: *Wednesday, 2022October5 at 23:48
*To: *bioc-devel at r-project.org <bioc-devel at r-project.org>
*Subject: *Re: [Bioc-devel] EXTERNAL: Interpreting BiocCheck output
Hi Giulia,
Are you using a recent version of BiocCheck?
If so, check the bottom of the BiocCheck::BiocCheck():
---
See the <packageName>.BiocCheck folder and run
browseVignettes(package = 'BiocCheck')
for details.
---
Can you provide more details, e.g., the repository of the package?
Thanks.
Best regards,
Marcel
On 10/4/22 4:44 AM, Giulia Pais wrote:
Hello, I?m having some issues in interpreting BiocCheck outputs, maybe
someone can tell me how to fix the issues.
I?ve got 2 main issues that cause the check to fail after normal
CRAN check has passed:
1. I get this error message
* Checking if other packages can import this one...
* ERROR: Packages providing 2 object(s) used in this package
should be imported in the NAMESPACE file, otherwise packages importing
this package may fail.
However it is nowhere mentioned which packages they are and where
those objects are instantiated so I have no clue how to solve this one
1. Since previous version of the package, which built and passed
checks without issues, I?ve been using a custom *.Rmd file placed in inst/rmd in the vignette to recycle the same chunk of code and optimizing time in phase of update (I update info only once instead of 4 times). Even if the package passes CRAN checks, BiocCheck errors telling me it can?t find this Rmd file and therefore can?t evaluate the chunk where it is mentioned. Any suggestion on this?
Thanks in advance
Giulia
[[alternative HTML version deleted]]
_______________________________________________ Bioc-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel
<https://secure-web.cisco.com/1BHJN2d_YaqvKQMHULUaRH7QNYQJdOhBmii2EQbiAbqa5Lkeb8i3hiUIfaWofD4P7qtrIBd4DMzICkiL7nxBM9QffrsbPxL3_kbkQFAg-yuAopFfphrSrtxM2B2Z0qp-DcUG2pechJ5QE0wfC6p5VsjrRr4nhPCl3WjsqZcBETYfmUItDeY_Br3CVecmoCk5k1gglA7riYZaVCfjP1NsjpliHO07urMoNlQIYYEyGXtdcZP0VSYaKiMgyYU41JtU_ZqKBSRUTtRknaIU5cZSeS6gHT4j4gobUCm1A0EVQToHkI-c8MgdgesyootE6ZRVht1uNPHivzeujJGoWsZJUQA/https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fbioc-devel> This email message may contain legally privileged and/or...{{dropped:2}}
_______________________________________________ Bioc-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel <https://secure-web.cisco.com/1BHJN2d_YaqvKQMHULUaRH7QNYQJdOhBmii2EQbiAbqa5Lkeb8i3hiUIfaWofD4P7qtrIBd4DMzICkiL7nxBM9QffrsbPxL3_kbkQFAg-yuAopFfphrSrtxM2B2Z0qp-DcUG2pechJ5QE0wfC6p5VsjrRr4nhPCl3WjsqZcBETYfmUItDeY_Br3CVecmoCk5k1gglA7riYZaVCfjP1NsjpliHO07urMoNlQIYYEyGXtdcZP0VSYaKiMgyYU41JtU_ZqKBSRUTtRknaIU5cZSeS6gHT4j4gobUCm1A0EVQToHkI-c8MgdgesyootE6ZRVht1uNPHivzeujJGoWsZJUQA/https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fbioc-devel>
This email message may contain legally privileged and/or...{{dropped:4}}
_______________________________________________
Bioc-devel at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel
I'm throwing in another 1 cent.
I agree that utils::globalVariables() is risky; since it goes in the
root of the package code, it applies to *all* functions in the
package, which is a bit too broad of a stroke for my taste. The way I
deal with false globals from non-standard evaluation (NSE), is to
declare them a as dummy variables local to the function. In this
case, I would use:
myfcn <- function() {
## To please R CMD check
mpg <- cyl <- NULL
mtcars |> select(mpg, cyl) |> head(3)
}
ADVANCED:
To avoid those dummy assignments from taking place in every call, one
can also do:
myfcn <- local({
## To please R CMD check
mpg <- cyl <- NULL
function() {
mtcars |> select(mpg, cyl) |> head(3)
}
})
which is also a bit cleaner, because it keeps the original function body as-is.
REALLY ADVANCED:
If you want to be fancy, you can even protect against mistakes by using:
myfcn <- local({
## To please R CMD check
mpg <- cyl <- NULL
## Prevent developer mistakes
lapply(names(environment()), function(name, envir) {
delayedAssign(
name,
stop(sprintf("INTERNAL ERROR: %s is not declared",
sQuote(name)), call. = FALSE),
assign.env = envir
)
}, envir = environment())
function() {
mtcars |> select(mpg, cyl) |> head(3)
}
})
The latter would throw an error, if you actually end up using 'mpg' or
'cyl' in a non-NSE way.
/Henrik
On Fri, Oct 7, 2022 at 12:29 PM Martin Morgan <mtmorgan.bioc at gmail.com> wrote:
Just my two cents, but I don?t think using `globalVariables()` is a good idea in a package ? it?s too easy to say that R should ignore a variable that it should not. In the context of dplyr, the alternative is to `importFrom dplyr .data` or to use ?standard? evaluation, depending on circumstance
mtcars |> as_tibble() |> filter(.data$mpg > 30) # .data is imported, so known?
# A tibble: 4 ? 11
mpg cyl disp hp drat wt qsec vs am gear carb
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 32.4 4 78.7 66 4.08 2.2 19.5 1 1 4 1
2 30.4 4 75.7 52 4.93 1.62 18.5 1 1 4 2
3 33.9 4 71.1 65 4.22 1.84 19.9 1 1 4 1
4 30.4 4 95.1 113 3.77 1.51 16.9 1 1 5 2
mtcars |> select("mpg", "cyl") |> head(3) # `?mpg?` and `?cyl?` are character vectors, not symbols?
mpg cyl Mazda RX4 21.0 6 Mazda RX4 Wag 21.0 6 Datsun 710 22.8 4 Martin From: Bioc-devel <bioc-devel-bounces at r-project.org> on behalf of Marcel Ramos <marcel.ramosperez at roswellpark.org> Date: Friday, October 7, 2022 at 3:07 PM To: bioc-devel at r-project.org <bioc-devel at r-project.org> Subject: Re: [Bioc-devel] Interpreting BiocCheck output Hi Giulia, Thanks for sharing. I took a look at https://github.com/calabrialab/ISAnalytics and I'm glad you resolved the issue. Just a reminder, you can also use `utils::globalVariables('.')` in your package for functions that use `'.'` (and other symbols) as a variable, e.g. in `purrr::pmap`. Best regards, Marcel On 10/6/22 4:34 AM, Giulia Pais wrote:
Hi, thanks for the reply. I managed to fix the first error as it was a
minor issue in the code, while for the second one I don?t have a
solution since the problem appears only locally and not on Biconductor
after the build.
Just for reference the package is ISAnalytics and the BiocCheck
version is the latest one.
Thanks again,
Giulia
*From: *Bioc-devel <bioc-devel-bounces at r-project.org> on behalf of
Marcel Ramos <marcel.ramosperez at roswellpark.org>
*Date: *Wednesday, 2022October5 at 23:48
*To: *bioc-devel at r-project.org <bioc-devel at r-project.org>
*Subject: *Re: [Bioc-devel] EXTERNAL: Interpreting BiocCheck output
Hi Giulia,
Are you using a recent version of BiocCheck?
If so, check the bottom of the BiocCheck::BiocCheck():
---
See the <packageName>.BiocCheck folder and run
browseVignettes(package = 'BiocCheck')
for details.
---
Can you provide more details, e.g., the repository of the package?
Thanks.
Best regards,
Marcel
On 10/4/22 4:44 AM, Giulia Pais wrote:
Hello, I?m having some issues in interpreting BiocCheck outputs, maybe
someone can tell me how to fix the issues.
I?ve got 2 main issues that cause the check to fail after normal
CRAN check has passed:
1. I get this error message
* Checking if other packages can import this one...
* ERROR: Packages providing 2 object(s) used in this package
should be imported in the NAMESPACE file, otherwise packages importing
this package may fail.
However it is nowhere mentioned which packages they are and where
those objects are instantiated so I have no clue how to solve this one
1. Since previous version of the package, which built and passed
checks without issues, I?ve been using a custom *.Rmd file placed in inst/rmd in the vignette to recycle the same chunk of code and optimizing time in phase of update (I update info only once instead of 4 times). Even if the package passes CRAN checks, BiocCheck errors telling me it can?t find this Rmd file and therefore can?t evaluate the chunk where it is mentioned. Any suggestion on this?
Thanks in advance
Giulia
[[alternative HTML version deleted]]
_______________________________________________ Bioc-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel
<https://secure-web.cisco.com/1BHJN2d_YaqvKQMHULUaRH7QNYQJdOhBmii2EQbiAbqa5Lkeb8i3hiUIfaWofD4P7qtrIBd4DMzICkiL7nxBM9QffrsbPxL3_kbkQFAg-yuAopFfphrSrtxM2B2Z0qp-DcUG2pechJ5QE0wfC6p5VsjrRr4nhPCl3WjsqZcBETYfmUItDeY_Br3CVecmoCk5k1gglA7riYZaVCfjP1NsjpliHO07urMoNlQIYYEyGXtdcZP0VSYaKiMgyYU41JtU_ZqKBSRUTtRknaIU5cZSeS6gHT4j4gobUCm1A0EVQToHkI-c8MgdgesyootE6ZRVht1uNPHivzeujJGoWsZJUQA/https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fbioc-devel> This email message may contain legally privileged and/or...{{dropped:2}}
_______________________________________________ Bioc-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel <https://secure-web.cisco.com/1BHJN2d_YaqvKQMHULUaRH7QNYQJdOhBmii2EQbiAbqa5Lkeb8i3hiUIfaWofD4P7qtrIBd4DMzICkiL7nxBM9QffrsbPxL3_kbkQFAg-yuAopFfphrSrtxM2B2Z0qp-DcUG2pechJ5QE0wfC6p5VsjrRr4nhPCl3WjsqZcBETYfmUItDeY_Br3CVecmoCk5k1gglA7riYZaVCfjP1NsjpliHO07urMoNlQIYYEyGXtdcZP0VSYaKiMgyYU41JtU_ZqKBSRUTtRknaIU5cZSeS6gHT4j4gobUCm1A0EVQToHkI-c8MgdgesyootE6ZRVht1uNPHivzeujJGoWsZJUQA/https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fbioc-devel>
This email message may contain legally privileged and/or...{{dropped:4}}
_______________________________________________ Bioc-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel [[alternative HTML version deleted]] _______________________________________________ Bioc-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel
Hi Giulia, hi all I often run BiocCheck::BiocCheck() on my packages and end up with errors, warnings and notes that have not printed specific enough messages, just as you did. When that happens, on the same R terminal, I use: BiocCheck::.BiocCheck$error BiocCheck::.BiocCheck$warning BiocCheck::.BiocCheck$note (please note the leading dot after the double colon) Those three lists include more specific details. Often even the file names and line numbers where the error occurred (In my experience I've found line numbers to not be always perfectly accurate, but it's a good enough approximation). There may be a better way to get that information through some BiocCheck log or other reporting facility, but that's convenient enough for me. I hope this helps you. Best Sergio El dv., 7 d?oct. 2022, 21:49, Henrik Bengtsson <henrik.bengtsson at gmail.com> va escriure:
I'm throwing in another 1 cent.
I agree that utils::globalVariables() is risky; since it goes in the
root of the package code, it applies to *all* functions in the
package, which is a bit too broad of a stroke for my taste. The way I
deal with false globals from non-standard evaluation (NSE), is to
declare them a as dummy variables local to the function. In this pl
case, I would use:
myfcn <- function() {
## To please R CMD check
mpg <- cyl <- NULL
mtcars |> select(mpg, cyl) |> head(3)
}
ADVANCED:
To avoid those dummy assignments from taking place in every call, one
can also do:
myfcn <- local({
## To please R CMD check
mpg <- cyl <- NULL
function() {
mtcars |> select(mpg, cyl) |> head(3)
}
})
which is also a bit cleaner, because it keeps the original function body
as-is.
REALLY ADVANCED:
If you want to be fancy, you can even protect against mistakes by using:
myfcn <- local({
## To please R CMD check
mpg <- cyl <- NULL
## Prevent developer mistakes
lapply(names(environment()), function(name, envir) {
delayedAssign(
name,
stop(sprintf("INTERNAL ERROR: %s is not declared",
sQuote(name)), call. = FALSE),
assign.env = envir
)
}, envir = environment())
function() {
mtcars |> select(mpg, cyl) |> head(3)
}
})
The latter would throw an error, if you actually end up using 'mpg' or
'cyl' in a non-NSE way.
/Henrik
On Fri, Oct 7, 2022 at 12:29 PM Martin Morgan <mtmorgan.bioc at gmail.com>
wrote:
Just my two cents, but I don?t think using `globalVariables()` is a good
idea in a package ? it?s too easy to say that R should ignore a variable that it should not.
In the context of dplyr, the alternative is to `importFrom dplyr .data`
or to use ?standard? evaluation, depending on circumstance
mtcars |> as_tibble() |> filter(.data$mpg > 30) # .data is imported,
so known?
# A tibble: 4 ? 11
mpg cyl disp hp drat wt qsec vs am gear carb
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 32.4 4 78.7 66 4.08 2.2 19.5 1 1 4 1
2 30.4 4 75.7 52 4.93 1.62 18.5 1 1 4 2
3 33.9 4 71.1 65 4.22 1.84 19.9 1 1 4 1
4 30.4 4 95.1 113 3.77 1.51 16.9 1 1 5 2
mtcars |> select("mpg", "cyl") |> head(3) # `?mpg?` and `?cyl?` are
character vectors, not symbols?
mpg cyl Mazda RX4 21.0 6 Mazda RX4 Wag 21.0 6 Datsun 710 22.8 4 Martin From: Bioc-devel <bioc-devel-bounces at r-project.org> on behalf of Marcel
Ramos <marcel.ramosperez at roswellpark.org>
Date: Friday, October 7, 2022 at 3:07 PM To: bioc-devel at r-project.org <bioc-devel at r-project.org> Subject: Re: [Bioc-devel] Interpreting BiocCheck output Hi Giulia, Thanks for sharing. I took a look at https://github.com/calabrialab/ISAnalytics and I'm glad you resolved the issue. Just a reminder, you can also use `utils::globalVariables('.')` in your package for functions that use `'.'` (and other symbols) as a variable, e.g. in `purrr::pmap`. Best regards, Marcel On 10/6/22 4:34 AM, Giulia Pais wrote:
Hi, thanks for the reply. I managed to fix the first error as it was a
minor issue in the code, while for the second one I don?t have a
solution since the problem appears only locally and not on Biconductor
after the build.
Just for reference the package is ISAnalytics and the BiocCheck
version is the latest one.
Thanks again,
Giulia
*From: *Bioc-devel <bioc-devel-bounces at r-project.org> on behalf of
Marcel Ramos <marcel.ramosperez at roswellpark.org>
*Date: *Wednesday, 2022October5 at 23:48
*To: *bioc-devel at r-project.org <bioc-devel at r-project.org>
*Subject: *Re: [Bioc-devel] EXTERNAL: Interpreting BiocCheck output
Hi Giulia,
Are you using a recent version of BiocCheck?
If so, check the bottom of the BiocCheck::BiocCheck():
---
See the <packageName>.BiocCheck folder and run
browseVignettes(package = 'BiocCheck')
for details.
---
Can you provide more details, e.g., the repository of the package?
Thanks.
Best regards,
Marcel
On 10/4/22 4:44 AM, Giulia Pais wrote:
Hello, I?m having some issues in interpreting BiocCheck outputs, maybe
someone can tell me how to fix the issues.
I?ve got 2 main issues that cause the check to fail after normal
CRAN check has passed:
1. I get this error message
* Checking if other packages can import this one...
* ERROR: Packages providing 2 object(s) used in this package
should be imported in the NAMESPACE file, otherwise packages importing
this package may fail.
However it is nowhere mentioned which packages they are and where
those objects are instantiated so I have no clue how to solve this one
1. Since previous version of the package, which built and passed
checks without issues, I?ve been using a custom *.Rmd file placed in inst/rmd in the vignette to recycle the same chunk of code and optimizing time in phase of update (I update info only once instead of 4 times). Even if the package passes CRAN checks, BiocCheck errors telling me it can?t find this Rmd file and therefore can?t evaluate the chunk where it is mentioned. Any suggestion on this?
Thanks in advance
Giulia
[[alternative HTML version deleted]]
_______________________________________________ Bioc-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel
<
This email message may contain legally privileged
and/or...{{dropped:2}}
_______________________________________________ Bioc-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel <
This email message may contain legally privileged and/or...{{dropped:4}}
_______________________________________________ Bioc-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel [[alternative HTML version deleted]] _______________________________________________ Bioc-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel
_______________________________________________ Bioc-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel
3 days later
If you are running locally, there is also a <package>.BiocCheck folder that gets created with a log that has the more specific information as well. Cheers, Lori Shepherd - Kern Bioconductor Core Team Roswell Park Comprehensive Cancer Center Department of Biostatistics & Bioinformatics Elm & Carlton Streets Buffalo, New York 14263
From: Bioc-devel <bioc-devel-bounces at r-project.org> on behalf of Sergio Oller <sergioller at gmail.com>
Sent: Saturday, October 8, 2022 4:38 AM
To: bioc-devel at r-project.org <bioc-devel at r-project.org>
Subject: Re: [Bioc-devel] Interpreting BiocCheck output
Sent: Saturday, October 8, 2022 4:38 AM
To: bioc-devel at r-project.org <bioc-devel at r-project.org>
Subject: Re: [Bioc-devel] Interpreting BiocCheck output
Hi Giulia, hi all
I often run BiocCheck::BiocCheck() on my packages and end up with errors,
warnings and notes that have not printed specific enough messages, just as
you did.
When that happens, on the same R terminal, I use:
BiocCheck::.BiocCheck$error
BiocCheck::.BiocCheck$warning
BiocCheck::.BiocCheck$note
(please note the leading dot after the double colon)
Those three lists include more specific details. Often even the file names
and line numbers where the error occurred (In my experience I've found line
numbers to not be always perfectly accurate, but it's a good enough
approximation).
There may be a better way to get that information through some BiocCheck
log or other reporting facility, but that's convenient enough for me. I
hope this helps you.
Best
Sergio
El dv., 7 d?oct. 2022, 21:49, Henrik Bengtsson <henrik.bengtsson at gmail.com>
va escriure:
> I'm throwing in another 1 cent.
>
> I agree that utils::globalVariables() is risky; since it goes in the
> root of the package code, it applies to *all* functions in the
> package, which is a bit too broad of a stroke for my taste. The way I
> deal with false globals from non-standard evaluation (NSE), is to
> declare them a as dummy variables local to the function. In this pl
> case, I would use:
>
> myfcn <- function() {
> ## To please R CMD check
> mpg <- cyl <- NULL
>
> mtcars |> select(mpg, cyl) |> head(3)
> }
>
>
> ADVANCED:
>
> To avoid those dummy assignments from taking place in every call, one
> can also do:
>
> myfcn <- local({
> ## To please R CMD check
> mpg <- cyl <- NULL
>
> function() {
> mtcars |> select(mpg, cyl) |> head(3)
> }
> })
>
> which is also a bit cleaner, because it keeps the original function body
> as-is.
>
>
> REALLY ADVANCED:
> If you want to be fancy, you can even protect against mistakes by using:
>
> myfcn <- local({
> ## To please R CMD check
> mpg <- cyl <- NULL
>
> ## Prevent developer mistakes
> lapply(names(environment()), function(name, envir) {
> delayedAssign(
> name,
> stop(sprintf("INTERNAL ERROR: %s is not declared",
> sQuote(name)), call. = FALSE),
> assign.env = envir
> )
> }, envir = environment())
>
> function() {
> mtcars |> select(mpg, cyl) |> head(3)
> }
> })
>
> The latter would throw an error, if you actually end up using 'mpg' or
> 'cyl' in a non-NSE way.
>
> /Henrik
>
> On Fri, Oct 7, 2022 at 12:29 PM Martin Morgan <mtmorgan.bioc at gmail.com>
> wrote:
> >
> > Just my two cents, but I don?t think using `globalVariables()` is a good
> idea in a package ? it?s too easy to say that R should ignore a variable
> that it should not.
> >
> > In the context of dplyr, the alternative is to `importFrom dplyr .data`
> or to use ?standard? evaluation, depending on circumstance
> >
> >
> > > mtcars |> as_tibble() |> filter(.data$mpg > 30) # .data is imported,
> so known?
> > # A tibble: 4 ? 11
> > mpg cyl disp hp drat wt qsec vs am gear carb
> > <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
> > 1 32.4 4 78.7 66 4.08 2.2 19.5 1 1 4 1
> > 2 30.4 4 75.7 52 4.93 1.62 18.5 1 1 4 2
> > 3 33.9 4 71.1 65 4.22 1.84 19.9 1 1 4 1
> > 4 30.4 4 95.1 113 3.77 1.51 16.9 1 1 5 2
> > > mtcars |> select("mpg", "cyl") |> head(3) # `?mpg?` and `?cyl?` are
> character vectors, not symbols?
> > mpg cyl
> > Mazda RX4 21.0 6
> > Mazda RX4 Wag 21.0 6
> > Datsun 710 22.8 4
> >
> > Martin
> >
> > From: Bioc-devel <bioc-devel-bounces at r-project.org> on behalf of Marcel
> Ramos <marcel.ramosperez at roswellpark.org>
> > Date: Friday, October 7, 2022 at 3:07 PM
> > To: bioc-devel at r-project.org <bioc-devel at r-project.org>
> > Subject: Re: [Bioc-devel] Interpreting BiocCheck output
> > Hi Giulia,
> >
> > Thanks for sharing.
> > I took a look at https://secure-web.cisco.com/1aXcD51cWOTTZe70tiCt6ZRCwUvekoIeEVzYUbBsmd3SAF2biL0Xz4j0btyW2apOx9duGM0EZQoqWUjmigcJoAA6b00uaxgeLzSfgilo-MrXdUTnGVGeCvVcKT0t4HKUFhFlOD5zUpUpYBVZ6yursleQv-rRmLv9jBkwAocGEPrEdGPhcdmRztaKQTX9J-G8EPxM0HV25FuTac5rEbFw6bCd2C7GebbWV-yKqIrlm0f9exsjHVabwnna17diW1vwDN0KNoTWLospRJPNWAi4mzr3oZUu4Xvajyt0GhRtUyDSNwmbvkkRK6w6TusuXVEJY/https%3A%2F%2Fgithub.com%2Fcalabrialab%2FISAnalytics and I'm glad
> > you resolved the issue.
> >
> > Just a reminder, you can also use `utils::globalVariables('.')` in your
> > package for functions
> > that use `'.'` (and other symbols) as a variable, e.g. in `purrr::pmap`.
> >
> > Best regards,
> >
> > Marcel
> >
> >
> > On 10/6/22 4:34 AM, Giulia Pais wrote:
> > >
> > > Hi, thanks for the reply. I managed to fix the first error as it was a
> > > minor issue in the code, while for the second one I don?t have a
> > > solution since the problem appears only locally and not on Biconductor
> > > after the build.
> > >
> > > Just for reference the package is ISAnalytics and the BiocCheck
> > > version is the latest one.
> > >
> > > Thanks again,
> > >
> > > Giulia
> > >
> > > *From: *Bioc-devel <bioc-devel-bounces at r-project.org> on behalf of
> > > Marcel Ramos <marcel.ramosperez at roswellpark.org>
> > > *Date: *Wednesday, 2022October5 at 23:48
> > > *To: *bioc-devel at r-project.org <bioc-devel at r-project.org>
> > > *Subject: *Re: [Bioc-devel] EXTERNAL: Interpreting BiocCheck output
> > >
> > > Hi Giulia,
> > >
> > > Are you using a recent version of BiocCheck?
> > >
> > > If so, check the bottom of the BiocCheck::BiocCheck():
> > >
> > > ---
> > > See the <packageName>.BiocCheck folder and run
> > > browseVignettes(package = 'BiocCheck')
> > > for details.
> > > ---
> > >
> > > Can you provide more details, e.g., the repository of the package?
> > >
> > > Thanks.
> > >
> > > Best regards,
> > >
> > > Marcel
> > >
> > > On 10/4/22 4:44 AM, Giulia Pais wrote:
> > > > Hello,
> > > > I?m having some issues in interpreting BiocCheck outputs, maybe
> > > someone can tell me how to fix the issues.
> > > >
> > > > I?ve got 2 main issues that cause the check to fail after normal
> > > CRAN check has passed:
> > > >
> > > > 1. I get this error message
> > > >
> > > > * Checking if other packages can import this one...
> > > >
> > > > * ERROR: Packages providing 2 object(s) used in this package
> > > should be imported in the NAMESPACE file, otherwise packages importing
> > > >
> > > > this package may fail.
> > > >
> > > >
> > > >
> > > > However it is nowhere mentioned which packages they are and where
> > > those objects are instantiated so I have no clue how to solve this one
> > > >
> > > > 1. Since previous version of the package, which built and passed
> > > checks without issues, I?ve been using a custom *.Rmd file placed in
> > > inst/rmd in the vignette to recycle the same chunk of code and
> > > optimizing time in phase of update (I update info only once instead of
> > > 4 times). Even if the package passes CRAN checks, BiocCheck errors
> > > telling me it can?t find this Rmd file and therefore can?t evaluate
> > > the chunk where it is mentioned. Any suggestion on this?
> > > >
> > > > Thanks in advance
> > > > Giulia
> > > >
> > > > [[alternative HTML version deleted]]
> > > >
> > > >
> > > > _______________________________________________
> > > > Bioc-devel at r-project.org mailing list
> > > > https://secure-web.cisco.com/1JiTJw_xSKUzGSQ-_qmDa5-rHoDQ3vP7QA1a4FJ30HayOeXv_NPkQ7_xpRrJmsv7EcsOFMYfPXX6G79DY_h0ln8AzJNLLT3stJEZJMYpIDl8yF_MGD5qAfVHvVKZtMn4SIiYGW3TvMHgFU0Y4umEqjg9u1McPeMi31BTIff9gg4S_Ko9uuz_82nP9GaU3ix8vFWeqzXzQL-QFxe1fG789NQ-eH1iShef6GE2bEjhXJlwpa03y2OSC6i0HzriLBtq90TWHIT62ydxqFzlDJvAR9BQjY0g9cLtQsqZyzu-aFa4z4PP9tGRBvt2cOq19pt_3/https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fbioc-devel
> > > <
> https://secure-web.cisco.com/1BHJN2d_YaqvKQMHULUaRH7QNYQJdOhBmii2EQbiAbqa5Lkeb8i3hiUIfaWofD4P7qtrIBd4DMzICkiL7nxBM9QffrsbPxL3_kbkQFAg-yuAopFfphrSrtxM2B2Z0qp-DcUG2pechJ5QE0wfC6p5VsjrRr4nhPCl3WjsqZcBETYfmUItDeY_Br3CVecmoCk5k1gglA7riYZaVCfjP1NsjpliHO07urMoNlQIYYEyGXtdcZP0VSYaKiMgyYU41JtU_ZqKBSRUTtRknaIU5cZSeS6gHT4j4gobUCm1A0EVQToHkI-c8MgdgesyootE6ZRVht1uNPHivzeujJGoWsZJUQA/https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fbioc-devel
> >
> > >
> > >
> > > This email message may contain legally privileged
> and/or...{{dropped:2}}
> > >
> > > _______________________________________________
> > > Bioc-devel at r-project.org mailing list
> > > https://secure-web.cisco.com/1JiTJw_xSKUzGSQ-_qmDa5-rHoDQ3vP7QA1a4FJ30HayOeXv_NPkQ7_xpRrJmsv7EcsOFMYfPXX6G79DY_h0ln8AzJNLLT3stJEZJMYpIDl8yF_MGD5qAfVHvVKZtMn4SIiYGW3TvMHgFU0Y4umEqjg9u1McPeMi31BTIff9gg4S_Ko9uuz_82nP9GaU3ix8vFWeqzXzQL-QFxe1fG789NQ-eH1iShef6GE2bEjhXJlwpa03y2OSC6i0HzriLBtq90TWHIT62ydxqFzlDJvAR9BQjY0g9cLtQsqZyzu-aFa4z4PP9tGRBvt2cOq19pt_3/https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fbioc-devel
> > > <
> https://secure-web.cisco.com/1BHJN2d_YaqvKQMHULUaRH7QNYQJdOhBmii2EQbiAbqa5Lkeb8i3hiUIfaWofD4P7qtrIBd4DMzICkiL7nxBM9QffrsbPxL3_kbkQFAg-yuAopFfphrSrtxM2B2Z0qp-DcUG2pechJ5QE0wfC6p5VsjrRr4nhPCl3WjsqZcBETYfmUItDeY_Br3CVecmoCk5k1gglA7riYZaVCfjP1NsjpliHO07urMoNlQIYYEyGXtdcZP0VSYaKiMgyYU41JtU_ZqKBSRUTtRknaIU5cZSeS6gHT4j4gobUCm1A0EVQToHkI-c8MgdgesyootE6ZRVht1uNPHivzeujJGoWsZJUQA/https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fbioc-devel
> >
> > >
> >
> > This email message may contain legally privileged and/or...{{dropped:4}}
> >
> > _______________________________________________
> > Bioc-devel at r-project.org mailing list
> > https://secure-web.cisco.com/1JiTJw_xSKUzGSQ-_qmDa5-rHoDQ3vP7QA1a4FJ30HayOeXv_NPkQ7_xpRrJmsv7EcsOFMYfPXX6G79DY_h0ln8AzJNLLT3stJEZJMYpIDl8yF_MGD5qAfVHvVKZtMn4SIiYGW3TvMHgFU0Y4umEqjg9u1McPeMi31BTIff9gg4S_Ko9uuz_82nP9GaU3ix8vFWeqzXzQL-QFxe1fG789NQ-eH1iShef6GE2bEjhXJlwpa03y2OSC6i0HzriLBtq90TWHIT62ydxqFzlDJvAR9BQjY0g9cLtQsqZyzu-aFa4z4PP9tGRBvt2cOq19pt_3/https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fbioc-devel
> >
> > [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > Bioc-devel at r-project.org mailing list
> > https://secure-web.cisco.com/1JiTJw_xSKUzGSQ-_qmDa5-rHoDQ3vP7QA1a4FJ30HayOeXv_NPkQ7_xpRrJmsv7EcsOFMYfPXX6G79DY_h0ln8AzJNLLT3stJEZJMYpIDl8yF_MGD5qAfVHvVKZtMn4SIiYGW3TvMHgFU0Y4umEqjg9u1McPeMi31BTIff9gg4S_Ko9uuz_82nP9GaU3ix8vFWeqzXzQL-QFxe1fG789NQ-eH1iShef6GE2bEjhXJlwpa03y2OSC6i0HzriLBtq90TWHIT62ydxqFzlDJvAR9BQjY0g9cLtQsqZyzu-aFa4z4PP9tGRBvt2cOq19pt_3/https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fbioc-devel
>
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://secure-web.cisco.com/1JiTJw_xSKUzGSQ-_qmDa5-rHoDQ3vP7QA1a4FJ30HayOeXv_NPkQ7_xpRrJmsv7EcsOFMYfPXX6G79DY_h0ln8AzJNLLT3stJEZJMYpIDl8yF_MGD5qAfVHvVKZtMn4SIiYGW3TvMHgFU0Y4umEqjg9u1McPeMi31BTIff9gg4S_Ko9uuz_82nP9GaU3ix8vFWeqzXzQL-QFxe1fG789NQ-eH1iShef6GE2bEjhXJlwpa03y2OSC6i0HzriLBtq90TWHIT62ydxqFzlDJvAR9BQjY0g9cLtQsqZyzu-aFa4z4PP9tGRBvt2cOq19pt_3/https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fbioc-devel
>
>
[[alternative HTML version deleted]]
_______________________________________________
Bioc-devel at r-project.org mailing list
https://secure-web.cisco.com/1JiTJw_xSKUzGSQ-_qmDa5-rHoDQ3vP7QA1a4FJ30HayOeXv_NPkQ7_xpRrJmsv7EcsOFMYfPXX6G79DY_h0ln8AzJNLLT3stJEZJMYpIDl8yF_MGD5qAfVHvVKZtMn4SIiYGW3TvMHgFU0Y4umEqjg9u1McPeMi31BTIff9gg4S_Ko9uuz_82nP9GaU3ix8vFWeqzXzQL-QFxe1fG789NQ-eH1iShef6GE2bEjhXJlwpa03y2OSC6i0HzriLBtq90TWHIT62ydxqFzlDJvAR9BQjY0g9cLtQsqZyzu-aFa4z4PP9tGRBvt2cOq19pt_3/https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fbioc-devel
This email message may contain legally privileged and/or confidential information. If you are not the intended recipient(s), or the employee or agent responsible for the delivery of this message to the intended recipient(s), you are hereby notified that any disclosure, copying, distribution, or use of this email message is prohibited. If you have received this message in error, please notify the sender immediately by e-mail and delete this email message from your computer. Thank you.