Re: [R] Forwarding missing arguments to the `[` method

2021-12-02 Thread Ivan Krylov
On Thu, 02 Dec 2021 13:41:52 -0800 Jeff Newmiller wrote: > I think you need a reprex... I don't think your claim is correct as > stated. Sorry, let me try again. The following "works" for me in the sense of throwing the same error on R 3.3 and R-devel: foo <- function(x, ...) UseMethod('foo')

Re: [R] A technical question on methods for "+"

2021-12-02 Thread Deepayan Sarkar
On Fri, Dec 3, 2021 at 3:14 AM Bert Gunter wrote: > > Those are both helpful comments. Would it not be useful to say > something along these lines in ?class. ? > The key point I missed is that there often(but not always) must be an > *explicit* class **attribute** for method dispatch; and class()

Re: [R] Question about Rfast colMins and colMaxs

2021-12-02 Thread Richard O'Keefe
What puzzles me is why you are not just using lapply(some.data.frame, min) lapply(some.data.frame, max) or as.vector(lapply(...)) Why go to another package for this? Is it the indices you want? col.min.indices <- function (some.data.frame) { v <- sapply(some.data.frame, function (column)

[R] SOMAscan data analysis

2021-12-02 Thread Kai Yang via R-help
Hello R team,we have a huge SOMAscan data set. This is an aptamer-based protecomics assay capable of measuring 1305 human protein analytes. does anyone know which package can load the data and do analysis? I apricate any suggestion, your experience, web page, paper  Thank you,Kai [[a

Re: [R] Forwarding missing arguments to the `[` method

2021-12-02 Thread Jeff Newmiller
I think you need a reprex... I don't think your claim is correct as stated. On December 2, 2021 1:00:01 PM PST, Ivan Krylov wrote: >Sorry for sending an unfinished message! > >On Thu, 2 Dec 2021 23:57:11 +0300 >Ivan Krylov wrote: > >> Why can I forward missing i,j to built-in `[` > >Why can I fo

Re: [R] A technical question on methods for "+"

2021-12-02 Thread Bert Gunter
Those are both helpful comments. Would it not be useful to say something along these lines in ?class. ? The key point I missed is that there often(but not always) must be an *explicit* class **attribute** for method dispatch; and class() does not indicate whether its value is explicit or not (just

[R] Forwarding missing arguments to the `[` method

2021-12-02 Thread Ivan Krylov
Hi everyone, Suppose I've got a class 'foo' that's a matrix tagged with a vector of length() == nrow(foo): foo <- function(x, ...) UseMethod('foo') foo.matrix <- function(x, y, ...) { stopifnot( !is.recursive(y), length(y) == nrow(x), length

[R] 2022 John M. Chambers Software Award

2021-12-02 Thread Raymond Wong
Dear R-help listers, I would like to let you know that submission window of the John M. Chambers Software Award is now open. The submission deadline is December 15, 2021. The Statistical Computing Section of the American Statistical Association announces the competition for the John M. Chambers

Re: [R] Forwarding missing arguments to the `[` method

2021-12-02 Thread Ivan Krylov
Sorry for sending an unfinished message! On Thu, 2 Dec 2021 23:57:11 +0300 Ivan Krylov wrote: > Why can I forward missing i,j to built-in `[` Why can I forward missing i,j to the built-in `[` method but not to user-defined methods? How can I fix this? Default i and j to TRUE? Are there less inv

Re: [R] A technical question on methods for "+"

2021-12-02 Thread Duncan Murdoch
The reason for this behaviour is that finding methods is a lot slower than just evaluating the built-in function. So R takes the time to determine if there's an attribute named "class" attached, but doesn't go searching further if there isn't one. Duncan Murdoch On 02/12/2021 3:10 p.m., Andr

Re: [R] A technical question on methods for "+"

2021-12-02 Thread Andrew Simmons
class() does not always return the class attribute, try something more like attr(, "class"), you'll see what I mean On Thu, Dec 2, 2021, 15:23 Bert Gunter wrote: > "This is because + dispatches on the class attribute, which a string > like "test" has set to NULL" > Not true. > > > class('test')

Re: [R] A technical question on methods for "+"

2021-12-02 Thread Bert Gunter
"This is because + dispatches on the class attribute, which a string like "test" has set to NULL" Not true. > class('test') [1] "character" But apparently, as Denes and Jeff said, the class must be explicitly set, rather than relying on its built-in/implicit type. With the above hint, I looked u

Re: [R] A technical question on methods for "+"

2021-12-02 Thread Andrew Simmons
This is because + dispatches on the class attribute, which a string like "test" has set to NULL, so it doesn't dispatch. You can add the class yourself like structure("test", class = "character") and that should work. I'm not sure where it's explained, but most primitive functions dispatch on the

Re: [R] A technical question on methods for "+"

2021-12-02 Thread Jeff Newmiller
I think the fact that character is a built-in type rather than an S3 class has something to do with it. On December 2, 2021 11:31:47 AM PST, Bert Gunter wrote: >... and probably a dumb one and almost certainly not of interest to >most R users. But anyway... > >?"+" says: >"The unary and binary a

[R] A technical question on methods for "+"

2021-12-02 Thread Bert Gunter
... and probably a dumb one and almost certainly not of interest to most R users. But anyway... ?"+" says: "The unary and binary arithmetic operators are generic functions: methods can be written for them individually or via the Ops group generic function. " So: "+.character" <- function(e1, e2)

Re: [R] Problem with lm Giving Wrong Results

2021-12-02 Thread Labone, Thomas
> summary(fit) Call: lm(formula = log(k) ~ Z) Residuals: Min 1Q Median 3Q Max -21.241 1.327 1.776 2.245 4.418 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.034650.01916 -1.809 0.0705 . Z -0.242070.01916 -12.634 <2e

Re: [R] Problem with lm Giving Wrong Results

2021-12-02 Thread Duncan Murdoch
On 02/12/2021 5:50 a.m., Labone, Thomas wrote: In the code below the first and second plots should look pretty much the same, the only difference being that the first has n=1000 points and the second n=1 points. On two of my Linux machines (info below) the second plot is a horizontal line

Re: [R] Problem with lm Giving Wrong Results

2021-12-02 Thread Bill Dunlap
On the 'bad' machines, what did you get for summary(fit) summary(k) summary(Z) summary(gm*gsd^Z) ? -Bill On Thu, Dec 2, 2021 at 6:18 AM Labone, Thomas wrote: > In the code below the first and second plots should look pretty much the > same, the only difference being that the first h

Re: [R] Problem with lm Giving Wrong Results

2021-12-02 Thread Ivan Krylov
On Thu, 2 Dec 2021 14:34:42 + "Labone, Thomas" wrote: > Can someone point me to the procedure for switching from the Intel > Math Library back to the standard math library so that I can see if > the problem is associated with using MKL? Depends on how you have installed it. You mentioned usi

Re: [R] Problem with lm Giving Wrong Results

2021-12-02 Thread Labone, Thomas
Thanks. Can someone point me to the procedure for switching from the Intel Math Library back to the standard math library so that I can see if the problem is associated with using MKL? Thomas R. LaBone PhD student Department of Epidemiology and Biostatistics Arnold School of Public Health Univ

Re: [R] Problem with lm Giving Wrong Results

2021-12-02 Thread J C Nash
I get two similar graphs. https://web.ncf.ca/nashjc/jfiles/Rplot-Labone-4095.pdf https://web.ncf.ca/nashjc/jfiles/RplotLabone10K.pdf Context: R version 4.1.2 (2021-11-01) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Linux Mint 20.2 Matrix products: default BLAS: /usr/lib/x86_64-linu

Re: [R] Problem with lm Giving Wrong Results

2021-12-02 Thread Eric Berger
Hi Thomas, I could not reproduce your problem. Both examples worked fine for me. Here is my setup: R version 4.1.2 (2021-11-01) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.3 LTS Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 LAPACK

[R] R 64 bit v 4.1.2

2021-12-02 Thread Francis, Mike
Good afternoon, Im hoping someone would be kind enough to help me with this issue. currently using Windows 10 (OS BUILD 19042.1348). when I try to open R as standalone or from R studio the R application crashes. did some investigations and it appears the RGUI.EXE and MSVCRT.dll are causing the

[R] Problem with lm Giving Wrong Results

2021-12-02 Thread Labone, Thomas
In the code below the first and second plots should look pretty much the same, the only difference being that the first has n=1000 points and the second n=1 points. On two of my Linux machines (info below) the second plot is a horizontal line (incorrect answer from lm), but on my Windows 10

Re: [R] Fwd: alternative way to define a function

2021-12-02 Thread Martin Møller Skarbiniks Pedersen
On Thu, 2 Dec 2021 at 12:40, Ivan Krylov wrote: > > > The \(arguments) syntax has been introduced in R 4.1.0: > https://cran.r-project.org/doc/manuals/r-release/NEWS.html (search for > "\(x)"). It is the same as function(arguments). > > The only benefit is slightly less typing; could be useful if

Re: [R] Fwd: alternative way to define a function

2021-12-02 Thread Ivan Krylov
On Thu, 2 Dec 2021 12:23:27 +0100 Martin Møller Skarbiniks Pedersen wrote: > Is that exactly the same as: > f <- function(x,y) x * y > ? > > Is there any benefit to the first or second way to define a function? The \(arguments) syntax has been introduced in R 4.1.0: https://cran.r-project.org/d

[R] Fwd: alternative way to define a function

2021-12-02 Thread Martin Møller Skarbiniks Pedersen
By reading some code today I have just discovered an alternative way to define a function: f <- \(x, y) x * y Is that exactly the same as: f <- function(x,y) x * y ? Is there any benefit to the first or second way to define a function? Regards Martin [[alternative HTML version deleted]]

Re: [R] Question about Rfast colMins and colMaxs

2021-12-02 Thread Stephen H. Dawson, DSL via R-help
Thank you, Bert. I appreciate you taking the time to write this information. Kindest Regards, *Stephen Dawson, DSL* /Executive Strategy Consultant/ Business & Technology +1 (865) 804-3454 http://www.shdawson.com On 12/1/21 12:23 PM, Bert Gunter wrote: "As to obtainin

Re: [R] readxl/lifecycle/rlang

2021-12-02 Thread Ivan Krylov
On Wed, 1 Dec 2021 16:38:37 -0500 Dennis Weygand wrote: > Installing package into > ‘C:/Users/dennisweygand/Documents/R/win-library/3.5’ (as ‘lib’ is > unspecified) It could be time to install a newer version of R. CRAN doesn't provide binary builds of packages for R 3.5... > binary s