[R-pkg-devel] CRAN Package Check Results - No protocol specified (OS X only)

2020-02-17 Thread Dominic Comtois
Hello,

On my package's check results (
https://cran.r-project.org/web/checks/check_results_summarytools.html), I
see a bunch of warnings with "No protocol specified" messages. This happens
only with OS X, and I can't reproduce them when actually building on a Mac,
nor with rhub::check_on_macos(). I can't really make sense out of them, and
they are all over the place. Can they simply be ignored?

Thx

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Catching console messages from libGL

2020-02-17 Thread Ivan Krylov
On Mon, 17 Feb 2020 14:56:31 -0500
Duncan Murdoch  wrote:

> So how do I capture stderr (or, off topic here, how do I get libGL to
> be quiet)?

libGL seems to only offer bad news in this regard: it writes directly
to stderr [1] and does not seem to offer a way to silence the
_LOADER_FATAL messages [2], which "failed to load driver: %s" are.

(You have found that out while I was preparing the message.)

As far as I understand do_sink(), it does not touch the actual stdout
or stderr, only R's wrappers of them. You probably know better than me
how portable would it be to try to reassign stderr (which the standard
says is a macro) to open_memstream() (which is POSIX.1-2008 only).

-- 
Best regards,
Ivan

[1]
https://sources.debian.org/src/mesa/19.3.3-1/src/glx/dri_common.c/#L52

[2]
https://sources.debian.org/src/mesa/19.3.3-1/src/glx/dri_common.h/#L70

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Catching console messages from libGL

2020-02-17 Thread Duncan Murdoch

On 17/02/2020 2:56 p.m., Duncan Murdoch wrote:

I'm working on the initialization code for rgl, especially for the case
when it is running remotely and the user is connecting using X11.

On some machines, this fails:  I now understand that's because the local
machine needs to enable "indirect GLX" (IGLX) for it to succeed, and by
default most current machines have IGLX disabled.  (It can be a security
risk to enable it.)

Failure looks like this (with the current CRAN version of rgl 0.100.47,
and the remote system running Ubuntu, my local system running MacOS):

  > library(rgl)
  > open3d()
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
X Error of failed request:  GLXBadContext
Major opcode of failed request:  149 (GLX)
Minor opcode of failed request:  6 (X_GLXIsDirect)
Serial number of failed request:  42
Current serial number in output stream:  41

I end up booted right out of R.  I now know how to fix that, and will
upload an update to CRAN in due course.

On MacOS I can enable IGLX by running

defaults write org.macosforge.xquartz.X11 enable_iglx -bool true

and restarting XQuartz.  When I do that, I see this (same setup as before):

  > library(rgl)
  > open3d()
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
glX
1

Now I want to suppress those two libGL messages, and I'm having trouble
figuring out how to do it.  If I redirect stderr when I start R, they
are redirected:  but if I do it after starting R, they aren't:

  > library(rgl)
  > capture.output(open3d(), type = "message")
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
glX
1
character(0)

(capture.output with type = "output" gets c("glX", "1"), but leaves the
libGL messages printing to the console.  sink() behaves similarly.)

So how do I capture stderr (or, off topic here, how do I get libGL to be
quiet)?



A little bit of progress.  After reading the Mesa 3d source, I can see 
that setting environment variable


 LIBGL_DEBUG=quiet

will suppress the first message.  Unfortunately, the second message is 
seen as "critical", and it can't be suppressed.


Duncan Murdoch

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


[R-pkg-devel] Catching console messages from libGL

2020-02-17 Thread Duncan Murdoch
I'm working on the initialization code for rgl, especially for the case 
when it is running remotely and the user is connecting using X11.


On some machines, this fails:  I now understand that's because the local 
machine needs to enable "indirect GLX" (IGLX) for it to succeed, and by 
default most current machines have IGLX disabled.  (It can be a security 
risk to enable it.)


Failure looks like this (with the current CRAN version of rgl 0.100.47, 
and the remote system running Ubuntu, my local system running MacOS):


> library(rgl)
> open3d()
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
X Error of failed request:  GLXBadContext
  Major opcode of failed request:  149 (GLX)
  Minor opcode of failed request:  6 (X_GLXIsDirect)
  Serial number of failed request:  42
  Current serial number in output stream:  41

I end up booted right out of R.  I now know how to fix that, and will 
upload an update to CRAN in due course.


On MacOS I can enable IGLX by running

  defaults write org.macosforge.xquartz.X11 enable_iglx -bool true

and restarting XQuartz.  When I do that, I see this (same setup as before):

> library(rgl)
> open3d()
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
glX
  1

Now I want to suppress those two libGL messages, and I'm having trouble 
figuring out how to do it.  If I redirect stderr when I start R, they 
are redirected:  but if I do it after starting R, they aren't:


> library(rgl)
> capture.output(open3d(), type = "message")
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
glX
  1
character(0)

(capture.output with type = "output" gets c("glX", "1"), but leaves the 
libGL messages printing to the console.  sink() behaves similarly.)


So how do I capture stderr (or, off topic here, how do I get libGL to be 
quiet)?


Duncan Murdoch

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Private S3 Method not Found

2020-02-17 Thread Richard M. Heiberger
latex() probably stopped midway through the compilation because you are
using intermediate routines other than the default.
For pdflatex, for example, you need to run
options(latexcmd='pdflatex', dviExtension='pdf', xdvicmd='open')
before using the latex() function.  See the Details section of ?latex.

To suppress the compilation, and stop with just the .tex file, use
print.default.
> tmp <- array(1:8, c(2,4), list(1:2,3:6))
> print.default(latex(tmp))
$file
[1] "tmp.tex"

$style
character(0)

attr(,"class")
[1] "latex"
>

The explicit result of the latex() function is a file name of class
"latex".  That way the automatic printing
feature of R shows the compiled file for that specific argument (tmp
in the example above).
Again in R terminology, the actual file "tmp.tex" is produced as a
side effect.  The tmp.tex file is designed
to be incorporated into your more comprehensive .tex file.

> tmp <- array(1:8, c(2,4), list(1:2,3:6))
> tmp.latex <- latex(tmp)
> print.default(tmp.latex)
$file
[1] "tmp.tex"

$style
character(0)

attr(,"class")
[1] "latex"


There are latex methods for many classes of objects.  formula is not
one of them.
>From your short initial description, it looks like what you are doing
could be thought of
as the latex.formula method.  I recommend doing it that way to get the
leverage of
all the other things the latex() and related functions do.  Once it is
working I suggest you
send your function to Frank Harrell (I cced him on this email) and
request that it be included as part of Hmisc::latex
You, of course, retain authorship

Rich

On Mon, Feb 17, 2020 at 10:54 AM  wrote:
>
> Hi Rich,
>
>
>
> I’m not doing the same thing as Hmisc::latex().  That generates a .tex file 
> and compiles it (or at least it appears to try to do that on my system, but 
> it stopped partway through for me).
>
>
>
> When I ran
>
>
>
> Hmisc::latex(a~b)
>
>
>
> It generated a .tex file for a table:
>
>
>
> \begin{table}[!tbp]
>
> \begin{center}
>
> \begin{tabular}{l}
>
> \hline\hline
>
> \multicolumn{1}{c}{}\tabularnewline
>
> \hline
>
> ~\tabularnewline
>
> a\tabularnewline
>
> b\tabularnewline
>
> \hline
>
> \end{tabular}\end{center}
>
> \end{table}
>
>
>
> While I’m wanting an equation:
>
>
>
> $$a = b$$
>
>
>
> Thanks,
>
>
>
> Bill
>
>
>
> From: Richard M. Heiberger 
> Sent: Monday, February 17, 2020 10:31 AM
> To: b...@denney.ws
> Cc: r-package-devel@r-project.org
> Subject: Re: [R-pkg-devel] Private S3 Method not Found
>
>
>
> Please be consistent with the latex() function in the Hmisc package.  For 
> example, for an array x, latex (x) produces a complete latex table 
> environment.  See the ?latex helpfile for details.
>
>
>
> Rich
>
>
>
> On Mon, Feb 17, 2020 at 10:07  wrote:
>
> Hello,
>
>
>
> I'm working on a function in a package that will provide an exported
> function that will convert formula to LaTeX equations.  For that, it
> recursively goes through the formula converting objects of class "formula",
> "call", "name", and "(" to LaTeX.
>
>
>
> I have a private S3 generic function that I'm using for the conversion, but
> for some reason, the generic is not detected, and checking the package fails
> for that reason
> (https://travis-ci.org/billdenney/bsd.report/jobs/651510333):
>
>
>
> no applicable method for 'knit_print_helper_formula' applied to an object of
> class "name"
>
> Backtrace:
>
>   1. testthat::expect_equal(...)
>
>   4. bsd.report:::knit_print.formula(a ~ b(c))
>
>   6. bsd.report:::knit_print_helper_formula.formula(x, ..., replacements =
> replacements)
>
>   9. bsd.report:::knit_print_helper_formula.call(x[[3]], ...)
>
> 10. bsd.report:::knit_print_helper_formula.function_call(x, ...)
>
> 11. base::sapply(...)
>
> 12. base::lapply(X = X, FUN = FUN, ...)
>
> 13. bsd.report:::FUN(X[[i]], ...)
>
>
>
> But, there is a knit_print_helper_formula.name function call defined
> (https://github.com/billdenney/bsd.report/blob/master/R/knit_print.formula.R
> #L60-L79):
>
>
>
> knit_print_helper_formula <- function(x, ...) {
>
>   UseMethod("knit_print_helper_formula")
>
> }
>
>
>
> # Some other methods
>
>
>
> knit_print_helper_formula.name <- function(x, ...) {
>
> # Function body
>
> }
>
>
>
> Does anyone know why the S3 method for name class objects is not found when
> checking the package?
>
>
>
> Thanks,
>
>
>
> Bill
>
>
> [[alternative HTML version deleted]]
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Private S3 Method not Found

2020-02-17 Thread Jeff Newmiller
I don't think it is possible to avoid exporting S3 methods from a package and 
still have the class behave as intended. Use a regular function if name 
encapsulation is important to you.

On February 17, 2020 8:33:30 AM PST, b...@denney.ws wrote:
>Thanks for the pointer!  Adding
>"S3method(knit_print_helper_formula,name)" to the NAMESPACE seems to
>have fixed it.
>
>For others who come across this, in roxygen2 parlance, that means
>using:
>
>#' @method knit_print_helper_formula name
>#' @export
>
>Even though the actual export is not desired.
>
>Thanks,
>
>Bill
>
>-Original Message-
>From: Duncan Murdoch  
>
>On 17/02/2020 10:05 a.m., b...@denney.ws wrote:
> 
>> Does anyone know why the S3 method for name class objects is not
>found 
>> when checking the package?
>
>I think you need to register knit_print_helper_formula.name as an S3
>method even if the generic is not exported.  I forget whether you do
>this in the NAMESPACE file or at runtime using registerS3method.
>
>__
>R-package-devel@r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-package-devel

-- 
Sent from my phone. Please excuse my brevity.

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Private S3 Method not Found

2020-02-17 Thread bill
Thanks for the pointer!  Adding "S3method(knit_print_helper_formula,name)" to 
the NAMESPACE seems to have fixed it.

For others who come across this, in roxygen2 parlance, that means using:

#' @method knit_print_helper_formula name
#' @export

Even though the actual export is not desired.

Thanks,

Bill

-Original Message-
From: Duncan Murdoch  

On 17/02/2020 10:05 a.m., b...@denney.ws wrote:
 
> Does anyone know why the S3 method for name class objects is not found 
> when checking the package?

I think you need to register knit_print_helper_formula.name as an S3 method 
even if the generic is not exported.  I forget whether you do this in the 
NAMESPACE file or at runtime using registerS3method.

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Private S3 Method not Found

2020-02-17 Thread bill
Hi Rich,

 

I’m not doing the same thing as Hmisc::latex().  That generates a .tex file and 
compiles it (or at least it appears to try to do that on my system, but it 
stopped partway through for me).

 

When I ran

 

Hmisc::latex(a~b)

 

It generated a .tex file for a table:

 

\begin{table}[!tbp]

\begin{center}

\begin{tabular}{l}

\hline\hline

\multicolumn{1}{c}{}\tabularnewline

\hline

~\tabularnewline

a\tabularnewline

b\tabularnewline

\hline

\end{tabular}\end{center}

\end{table}

 

While I’m wanting an equation:

 

$$a = b$$

 

Thanks,

 

Bill

 

From: Richard M. Heiberger  
Sent: Monday, February 17, 2020 10:31 AM
To: b...@denney.ws
Cc: r-package-devel@r-project.org
Subject: Re: [R-pkg-devel] Private S3 Method not Found

 

Please be consistent with the latex() function in the Hmisc package.  For 
example, for an array x, latex (x) produces a complete latex table environment. 
 See the ?latex helpfile for details.

 

Rich

 

On Mon, Feb 17, 2020 at 10:07 mailto:b...@denney.ws> > wrote:

Hello,



I'm working on a function in a package that will provide an exported
function that will convert formula to LaTeX equations.  For that, it
recursively goes through the formula converting objects of class "formula",
"call", "name", and "(" to LaTeX.



I have a private S3 generic function that I'm using for the conversion, but
for some reason, the generic is not detected, and checking the package fails
for that reason
(https://travis-ci.org/billdenney/bsd.report/jobs/651510333):



no applicable method for 'knit_print_helper_formula' applied to an object of
class "name"

Backtrace:

  1. testthat::expect_equal(...)

  4. bsd.report:::knit_print.formula(a ~ b(c))

  6. bsd.report:::knit_print_helper_formula.formula(x, ..., replacements =
replacements)

  9. bsd.report:::knit_print_helper_formula.call(x[[3]], ...)

10. bsd.report:::knit_print_helper_formula.function_call(x, ...)

11. base::sapply(...)

12. base::lapply(X = X, FUN = FUN, ...)

13. bsd.report:::FUN(X[[i]], ...)



But, there is a knit_print_helper_formula.name 
  function call defined
(https://github.com/billdenney/bsd.report/blob/master/R/knit_print.formula.R 

 
#L60-L79):



knit_print_helper_formula <- function(x, ...) {

  UseMethod("knit_print_helper_formula")

}



# Some other methods



knit_print_helper_formula.name   <- 
function(x, ...) {

# Function body

}



Does anyone know why the S3 method for name class objects is not found when
checking the package?



Thanks,



Bill


[[alternative HTML version deleted]]

__
R-package-devel@r-project.org   mailing 
list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Private S3 Method not Found

2020-02-17 Thread Richard M. Heiberger
Please be consistent with the latex() function in the Hmisc package.  For
example, for an array x, latex (x) produces a complete latex table
environment.  See the ?latex helpfile for details.

Rich

On Mon, Feb 17, 2020 at 10:07  wrote:

> Hello,
>
>
>
> I'm working on a function in a package that will provide an exported
> function that will convert formula to LaTeX equations.  For that, it
> recursively goes through the formula converting objects of class "formula",
> "call", "name", and "(" to LaTeX.
>
>
>
> I have a private S3 generic function that I'm using for the conversion, but
> for some reason, the generic is not detected, and checking the package
> fails
> for that reason
> (https://travis-ci.org/billdenney/bsd.report/jobs/651510333):
>
>
>
> no applicable method for 'knit_print_helper_formula' applied to an object
> of
> class "name"
>
> Backtrace:
>
>   1. testthat::expect_equal(...)
>
>   4. bsd.report:::knit_print.formula(a ~ b(c))
>
>   6. bsd.report:::knit_print_helper_formula.formula(x, ..., replacements =
> replacements)
>
>   9. bsd.report:::knit_print_helper_formula.call(x[[3]], ...)
>
> 10. bsd.report:::knit_print_helper_formula.function_call(x, ...)
>
> 11. base::sapply(...)
>
> 12. base::lapply(X = X, FUN = FUN, ...)
>
> 13. bsd.report:::FUN(X[[i]], ...)
>
>
>
> But, there is a knit_print_helper_formula.name function call defined
> (
> https://github.com/billdenney/bsd.report/blob/master/R/knit_print.formula.R
> #L60-L79
> 
> ):
>
>
>
> knit_print_helper_formula <- function(x, ...) {
>
>   UseMethod("knit_print_helper_formula")
>
> }
>
>
>
> # Some other methods
>
>
>
> knit_print_helper_formula.name <- function(x, ...) {
>
> # Function body
>
> }
>
>
>
> Does anyone know why the S3 method for name class objects is not found when
> checking the package?
>
>
>
> Thanks,
>
>
>
> Bill
>
>
> [[alternative HTML version deleted]]
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Private S3 Method not Found

2020-02-17 Thread Duncan Murdoch

On 17/02/2020 10:05 a.m., b...@denney.ws wrote:

Hello,

  


I'm working on a function in a package that will provide an exported
function that will convert formula to LaTeX equations.  For that, it
recursively goes through the formula converting objects of class "formula",
"call", "name", and "(" to LaTeX.

  


I have a private S3 generic function that I'm using for the conversion, but
for some reason, the generic is not detected, and checking the package fails
for that reason
(https://travis-ci.org/billdenney/bsd.report/jobs/651510333):

  


no applicable method for 'knit_print_helper_formula' applied to an object of
class "name"

Backtrace:

   1. testthat::expect_equal(...)

   4. bsd.report:::knit_print.formula(a ~ b(c))

   6. bsd.report:::knit_print_helper_formula.formula(x, ..., replacements =
replacements)

   9. bsd.report:::knit_print_helper_formula.call(x[[3]], ...)

10. bsd.report:::knit_print_helper_formula.function_call(x, ...)

11. base::sapply(...)

12. base::lapply(X = X, FUN = FUN, ...)

13. bsd.report:::FUN(X[[i]], ...)

  


But, there is a knit_print_helper_formula.name function call defined
(https://github.com/billdenney/bsd.report/blob/master/R/knit_print.formula.R
#L60-L79):

  


knit_print_helper_formula <- function(x, ...) {

   UseMethod("knit_print_helper_formula")

}

  


# Some other methods

  


knit_print_helper_formula.name <- function(x, ...) {

# Function body

}

  


Does anyone know why the S3 method for name class objects is not found when
checking the package?



I think you need to register knit_print_helper_formula.name as an S3 
method even if the generic is not exported.  I forget whether you do 
this in the NAMESPACE file or at runtime using registerS3method.


Duncan Murdoch

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


[R-pkg-devel] Private S3 Method not Found

2020-02-17 Thread bill
Hello,

 

I'm working on a function in a package that will provide an exported
function that will convert formula to LaTeX equations.  For that, it
recursively goes through the formula converting objects of class "formula",
"call", "name", and "(" to LaTeX.

 

I have a private S3 generic function that I'm using for the conversion, but
for some reason, the generic is not detected, and checking the package fails
for that reason
(https://travis-ci.org/billdenney/bsd.report/jobs/651510333):

 

no applicable method for 'knit_print_helper_formula' applied to an object of
class "name"

Backtrace:

  1. testthat::expect_equal(...)

  4. bsd.report:::knit_print.formula(a ~ b(c))

  6. bsd.report:::knit_print_helper_formula.formula(x, ..., replacements =
replacements)

  9. bsd.report:::knit_print_helper_formula.call(x[[3]], ...)

10. bsd.report:::knit_print_helper_formula.function_call(x, ...)

11. base::sapply(...)

12. base::lapply(X = X, FUN = FUN, ...)

13. bsd.report:::FUN(X[[i]], ...)

 

But, there is a knit_print_helper_formula.name function call defined
(https://github.com/billdenney/bsd.report/blob/master/R/knit_print.formula.R
#L60-L79):

 

knit_print_helper_formula <- function(x, ...) {

  UseMethod("knit_print_helper_formula")

}

 

# Some other methods

 

knit_print_helper_formula.name <- function(x, ...) {

# Function body

}

 

Does anyone know why the S3 method for name class objects is not found when
checking the package?

 

Thanks,

 

Bill


[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel