[R] There is a relationship of the Modify-in-place optimisation of a object and the local variable `*tmp*`?

2021-10-07 Thread Ben Deivide de Oliveira Batista
Dear R users, When modify-in-place of objects occurs, is there a local variable called `*tmp*`, behind the scenes R? Let's look at two examples to understand the question. Example 1 (R Language Definition) -- > x <- 1:10 > tracemem(x) [1] "<000

Re: [R] Extracting Comments from Functions/Packages

2021-10-07 Thread Enrico Schumann
On Thu, 07 Oct 2021, Leonard Mada via R-help writes: > Dear R Users, > > > I wrote a minimal parser to extract strings and > comments from the function definitions. > > > The string extraction works fine. But there are no comments: > > a.) Are the comments stripped from the compiled packages? > >

Re: [R] How to use ifelse without invoking warnings

2021-10-07 Thread John Fox
Dear Ravi, It's already been suggested that you could disable warnings, but that's risky in case there's a warning that you didn't anticipate. Here's a different approach: > kk <- k[k >= -1 & k <= n] > ans <- numeric(length(k)) > ans[k > n] <- 1 > ans[k >= -1 & k <= n] <- pbeta(p, kk + 1, n -

Re: [R] How to use ifelse without invoking warnings

2021-10-07 Thread Sarah Goslee
Bert's approach is much less risky! On Thu, Oct 7, 2021 at 1:37 PM Bert Gunter wrote: > > ?suppressWarnings > > > p <- .05 > > k <- c(-1.2,-0.5, 1.5, 10.4) > > n <- 10 > > > > ans <- ifelse (k >= -1 & k <= n, pbeta(p,k+1,n-k,lower.tail=FALSE), > ifelse (k < -1, 0, 1) ) > Warning message: > In pbe

Re: [R] How to use ifelse without invoking warnings

2021-10-07 Thread Sarah Goslee
If you are positive the warnings don't matter for your application, you can disable them: see ?options for details of warn. But that can be dangerous, so be careful! Sarah On Thu, Oct 7, 2021 at 1:21 PM Ravi Varadhan via R-help wrote: > > Hi, > I would like to execute the following vectorized c

Re: [R] How to use ifelse without invoking warnings

2021-10-07 Thread Bert Gunter
?suppressWarnings > p <- .05 > k <- c(-1.2,-0.5, 1.5, 10.4) > n <- 10 > > ans <- ifelse (k >= -1 & k <= n, pbeta(p,k+1,n-k,lower.tail=FALSE), ifelse (k < -1, 0, 1) ) Warning message: In pbeta(p, k + 1, n - k, lower.tail = FALSE) : NaNs produced > > suppressWarnings(ans <- ifelse (k >= -1 & k <= n,

[R] How to use ifelse without invoking warnings

2021-10-07 Thread Ravi Varadhan via R-help
Hi, I would like to execute the following vectorized calculation: ans <- ifelse (k >= -1 & k <= n, pbeta(p, k+1, n-k, lower.tail = FALSE), ifelse (k < -1, 0, 1) ) For example: > k <- c(-1.2,-0.5, 1.5, 10.4) > n <- 10 > ans <- ifelse (k >= -1 & k <= n, pbeta(p,k+1,n-k,lower.tail=FALSE), ifels

[R] Extracting Comments from Functions/Packages

2021-10-07 Thread Leonard Mada via R-help
Dear R Users, I wrote a minimal parser to extract strings and comments from the function definitions. The string extraction works fine. But there are no comments: a.) Are the comments stripped from the compiled packages? b.) Alternatively: Is the deparse() not suited for this task? b.2.)

Re: [R] Unusual Error Loading tidyverse

2021-10-07 Thread Conklin, Mike (GfK) via R-help
My experience is that the combination of OneDrive and R leads to lack of productivity. -- W. Michael Conklin EVP Marketing & Data Sciences GfK M +1 612 567 8287 -Original Message- From: R-help On Behalf Of Kevin Thorpe Sent: Thursday, October 7, 2021 10:50 AM To: Jeff Newmiller Cc: R

Re: [R] Unusual Error Loading tidyverse

2021-10-07 Thread Kevin Thorpe
Nice fortune. In retrospect, maybe it would have worked to re-build the user library. Things were acting so strangely to me I opted for the direct, if more dangerous approach. :-) > On Oct 7, 2021, at 11:37 AM, Jeff Newmiller wrote: > > Sad, more like. > > fortunes::fortune(337) > > You wo

Re: [R] Unusual Error Loading tidyverse

2021-10-07 Thread Jeff Newmiller
Sad, more like. fortunes::fortune(337) You would have done just as well to delete the user library and let R prompt you to re-create it if things were that bad. Note that the default R configuration always looks first in the user library and only falls back to the system library if the desired

Re: [R] RSQLite slowness

2021-10-07 Thread Rasmus Liland
Dear Martin Morgan, Thanks for all those links! Yes, my question can be characterized like that I think, traditional way writing a temporary table into the database and left JOINing the others vs. parameterized query. A relevant example would be to first create the database from the compr

Re: [R] Unusual Error Loading tidyverse

2021-10-07 Thread Kevin Thorpe
I thought I would close the loop on this. It was really weird and I don’t understand everything that went on. First, it was indeed the case that the main library was not writeable so packages were being installed in a user library. Here is where it gets confusing to me. Both library paths did a

Re: [R] RSQLite slowness

2021-10-07 Thread Rasmus Liland
On 2021-10-06 12:11 -0700, Jeff Newmiller wrote: > FWIW all SQL implementations work > better with indexes An index seems to be a good way to improve sql performance, I'll look into it. Best, Rasmus signature.asc Description: PGP signature __ R-hel

Re: [R] RSQLite slowness

2021-10-07 Thread Rasmus Liland
Dear Ivan, Thanks for that explaination! I think it explains the slowness clearly. It is possible to use carray is in Rust [1] so it might be available in R in the future(?) I'll look into rusqlite some time at least. sqlite is supposed to be one of the fastest sql implementations. Realm

Re: [R] adding results to plot

2021-10-07 Thread PIKAL Petr
Hallo Rui. I finally tested your function and it seems to me that it should propagate to the core R or at least to the stats package. Although it is a bit overkill for my purpose, its use is straightforward and simple. I checked it for several *test functions and did not find any problem. Thanks

[R] Tidygrraph example not working

2021-10-07 Thread Monica Palaseanu-Lovejoy
Hi, I am trying to learn more about tidygraph, so i am following this blog: https://www.data-imaginist.com/2017/introducing-tidygraph/ Few months ago the examples in the blog worked very well, but today they do not. I just installed R x64 4.1.1, so i should be up and running with the latest on a

Re: [R] RSQLite slowness

2021-10-07 Thread Ivan Krylov
On Wed, 6 Oct 2021 16:23:15 + Rasmus Liland wrote: >"SELECT * FROM gene2refseq > LEFT JOIN gene_info ON > gene_info.GeneID = gene2refseq.GeneID > WHERE gene2refseq.`RNA_nucleotide_accession.version` > LIKE ?" <...> > x1 <- DBI::dbGetQuery(

Re: [R] Strange behavior of 2-d array within function

2021-10-07 Thread PIKAL Petr
Hi I would print/save iteration number to see at what time this occured and probably traceback() could give you some hint. Alternatively you could make a function from your code see ?function and use debug to trace the error. Without some working example it is impossible to see where is the probl