[R] The argument 'eps.Pvalue' of `printCoefmat()`

2023-10-29 Thread Shu Fai Cheung
Hi all, Just a minor issue that I am not sure whether this is considered a "bug." It is about the help page. In the help page of printCoefmat(), for the argument 'eps.Pvalue', the description is as below: number, .. I have to read the source to figure out that this argument is to be used by

Re: [R] Create a call but evaluate only some elements

2023-10-25 Thread Shu Fai Cheung
bquote), > see Section 6: "Computing on the Language" in the R Language > Definition manual. Actually, if you are interested in a concise > (albeit dense) overview of the R Language, you might consider going > through the whole manual. > > Cheers, > Bert > > On

Re: [R] Create a call but evaluate only some elements

2023-10-25 Thread Shu Fai Cheung
an try either of these: > > expr <- bquote(lm(.(as.formula(mod)), dat)) > lm_out5 <- eval(expr) > > expr <- call("lm", as.formula(mod), as.symbol("dat")) > lm_out6 <- eval(expr) > > but bquote is usually easier and good enough. > > On W

Re: [R] Create a call but evaluate only some elements

2023-10-25 Thread Shu Fai Cheung
Sorry for a typo, regarding the first attempt, lm_out2, using do.call(), I meant: 'It does have the formula, "as a formula": y ~ x1 + x2. However, the name "dat" is evaluated. ...' Regards, Shu Fai On Wed, Oct 25, 2023 at 5:09 PM Shu Fai Cheung wrote: > > Hi All, >

[R] Create a call but evaluate only some elements

2023-10-25 Thread Shu Fai Cheung
Hi All, I have a problem that may have a simple solution, but I am not familiar with creating calls manually. This is example calling lm() ``` r set.seed(1234) n <- 10 dat <- data.frame(x1 = rnorm(n), x2 = rnorm(n), y = rnorm(n)) lm_out <- lm(y ~ x1 + x2,

Re: [R] Plot to a device and examine the plot?

2023-10-15 Thread Shu Fai Cheung
ul > > On 16/10/23 05:24, Duncan Murdoch wrote: > > On 15/10/2023 12:05 p.m., Shu Fai Cheung wrote: > > > Let me clarify my question: > > > > > > plot.new() > > > polygon(c(.5, .5, .75, .8), c(.25, .3, .4, .5)) > > > > > > If

Re: [R] Plot to a device and examine the plot?

2023-10-15 Thread Shu Fai Cheung
Thanks a lot for introducing these functions! I am not aware of them but it seems that they can help me to do what I want to do. Regards, Shu Fai Regards, Shu Fai Cheung (張樹輝) On Mon, Oct 16, 2023 at 12:24 AM Duncan Murdoch wrote: > > On 15/10/2023 12:05 p.m., Shu Fai Cheung wrote: >

Re: [R] Plot to a device and examine the plot?

2023-10-15 Thread Shu Fai Cheung
in this area. If the device is an image file, then I can check the color of a pixel. I would like to know whether I can do the same with an on-screen device. Thanks. Regards, Shu Fai On Sun, Oct 15, 2023 at 11:44 PM Shu Fai Cheung wrote: > Sorry that I did not make my question clear eno

Re: [R] Plot to a device and examine the plot?

2023-10-15 Thread Shu Fai Cheung
t; > Note that the type of device in your example is system-dependent. The > content in a png() would be different than the content in a win.graph() > device. > > On October 15, 2023 8:04:00 AM PDT, Shu Fai Cheung < > shufai.che...@gmail.com> wrote: > >Hi All, > &g

[R] Plot to a device and examine the plot?

2023-10-15 Thread Shu Fai Cheung
Hi All, I want to inspect the content of a plot generated by another function. For example: plot.new() polygon(c(.5, .5, .75, .8), c(.25, .3, .4, .5)) A polygon will be drawn. If I do not know what has been done to generate the plot, is it possible to query the content in the active device?

[R] save(), load(), saveRDS(), and readRDS()

2023-09-28 Thread Shu Fai Cheung
Hi All, There is a thread about the use of save(), load(), saveRDS(), and loadRDS(). It led me to think about a question regarding them. In my personal work, I prefer using saveRDS() and loadRDS() as I don't like the risk of overwriting anything in the global environment. I also like the freedom

Re: [R] save() and load()

2023-09-25 Thread Shu Fai Cheung
Hi, You can try this: head(irisdata) Objects loaded by load() keep their names when being saved. In your case, it is 'irisdata'. You can also use verbose = TRUE to show the names of objects loaded: load(file = "irisdataTest.RData", verbose = TRUE) Hope this helps. Regards, Shu Fai On Tue,

Re: [R] MASS::mvrnorm() on MKL may produce different numbers even when the seed is the same?

2023-08-17 Thread Shu Fai Cheung
ciativity of floating point arithmetic. > This article gives a way to make results repeatable: > > https://www.intel.com/content/www/us/en/developer/articles/technical/introduction-to-the-conditional-numerical-reproducibility-cnr.html > > -Bill > > On Wed, Aug 16, 2023 at 8:

Re: [R] MASS::mvrnorm() on MKL may produce different numbers even when the seed is the same?

2023-08-17 Thread Shu Fai Cheung
on (and method="svd" give the > same values). With method="chol" I get different values, but again > consistent across machines. > > Ah, mvtnorm::rmvnorm() applies the results from eigen() in a different > way that appears to be less (not?) affected by the indetermi

[R] MASS::mvrnorm() on MKL may produce different numbers even when the seed is the same?

2023-08-16 Thread Shu Fai Cheung
Hi All, When addressing an error in one of my packages in the CRAN check at CRAN, I found something strange which, I believe, is unrelated to my package. I am not sure whether it is a bug or a known issue. Therefore, I would like to have advice from experts here. The error at CRAN check occurred

Re: [R] printCoefmat() and zap.ind

2023-07-08 Thread Shu Fai Cheung
** #> --- #> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ``` I have to round the two columns first before calling printCoefmat(). Not nice but works for now. Regards, Shu Fai Cheung 在 2023年7月8日週六 00:41,Martin Maechler 寫道: > >>>>> Martin Maechler > &

[R] printCoefmat() and zap.ind

2023-07-06 Thread Shu Fai Cheung
***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ``` However, this solution is not ideal because the numbers of decimal places of "Estimate" and "Std. Error" are different. How can I get the output like this one? ```r #> Estimate Std. Error t value Pr(>|t|) #>