similar to: can we override "if" in R?

Displaying 20 results from an estimated 20000 matches similar to: "can we override "if" in R?"

2017 Mar 04
5
can we override "if" in R?
I'm just curious. Why making "if" generic is even more dangerous? Best, Da On Sat, Mar 4, 2017 at 1:22 PM, G?bor Cs?rdi <csardi.gabor at gmail.com> wrote: > `!` is a generic, `if` is not. You can define an `if` that is generic, > but this might be even more dangerous.... > > ? `if` <- function(a, b, c) UseMethod("if") > ? `if.default` <-
2017 Mar 04
2
can we override "if" in R?
Thanks. Can I override it for a specific class? I can do that for operators such as "!". For example, "!.fm" works for objects of the class "fm". It seems I can't do the same for "if". Best, Da On Sat, Mar 4, 2017 at 12:41 PM, G?bor Cs?rdi <csardi.gabor at gmail.com> wrote: > You can. Perhaps needless to say, be careful with this. > > ?
2017 Mar 04
2
can we override "if" in R?
In my case, I create a new type of matrices and override matrix operations in R for these matrices. My goal is to make the system as transparent as possible, which means my system should execute the existing R code without modification. The problem is that when data is in my own vectors or matrices, "if" or "while" can't access their values unless we explicitly convert them
2017 Mar 05
3
can we override "if" in R?
On Sun, Mar 5, 2017 at 2:50 PM, Michael Lawrence <lawrence.michael at gene.com> wrote: > > > On Sat, Mar 4, 2017 at 12:36 PM, Da Zheng <zhengda1936 at gmail.com> wrote: >> >> In my case, I create a new type of matrices and override matrix >> operations in R for these matrices. >> My goal is to make the system as transparent as possible, which means
2017 Mar 06
1
can we override "if" in R?
I can't comment for Da, but one example where the ability to make 'if' generic would have been desirable: A couple of years ago I wrote S3 classes and methods for 1-byte integers and logicals stored as raw vectors, in order to handle massive amounts of genetic data (by the standards of the day). Everything worked pretty nicely, ie I could "methodize" just about everything I
2017 Mar 05
0
can we override "if" in R?
On Sat, Mar 4, 2017 at 12:36 PM, Da Zheng <zhengda1936 at gmail.com> wrote: > In my case, I create a new type of matrices and override matrix > operations in R for these matrices. > My goal is to make the system as transparent as possible, which means > my system should execute the existing R code without modification. > The problem is that when data is in my own vectors or
2017 Mar 04
0
can we override "if" in R?
I'm curious as to precisely why someone would want to do this. On Sat, Mar 4, 2017 at 11:49 AM, Da Zheng <zhengda1936 at gmail.com> wrote: > I'm just curious. Why making "if" generic is even more dangerous? > > Best, > Da > > On Sat, Mar 4, 2017 at 1:22 PM, G?bor Cs?rdi <csardi.gabor at gmail.com> > wrote: > > `!` is a generic, `if` is
2017 Mar 05
0
can we override "if" in R?
Because the S3 class system is very informal. E.g. if you happen to have an `if.whatever` function, that will be automatically a method of your generic. Gabor On Sat, Mar 4, 2017 at 7:49 PM, Da Zheng <zhengda1936 at gmail.com> wrote: > I'm just curious. Why making "if" generic is even more dangerous? > > Best, > Da > > On Sat, Mar 4, 2017 at 1:22 PM, G?bor
2017 Mar 06
0
can we override "if" in R?
Da, I've been following this thread and I'm still confused as to exactly what you want/why you want it. I'm probably just missing some context here, but, If() doesn't operate on matrices, generally. Can you give an example of the type of code you want to have continue to run that requires if operation *directly* on one of your matrix objects, as opposed, say, to a value pulled
2017 Jan 27
4
cross-platform portable code in CRAN Repository Policy
Hello, I'm trying to submit my package to CRAN. When I read the policy, it says: Package authors should make all reasonable efforts to provide cross-platform portable code. Packages will not normally be accepted that do not run on at least two of the major R platforms. What major R platforms does this policy refer to? Currently, my package runs in Ubuntu. If it works on both Ubuntu and
2017 Jan 27
2
cross-platform portable code in CRAN Repository Policy
On 27 January 2017 at 21:54, G?bor Cs?rdi wrote: | On Fri, Jan 27, 2017 at 9:28 PM, Da Zheng <zhengda1936 at gmail.com> wrote: | > What major R platforms does this policy refer to? | > | | Linux, macOS, Windows. | | | > Currently, my package runs in Ubuntu. If it works on both Ubuntu and | > Redhat, does it count as two platforms? | > | | I think that Linux is just one. Is
2015 Dec 24
2
override pmin/pmax for my own matrix
Hello, I'm trying to override pmin and pmax for my own matrix. These two functions have ... as an argument. I tried to override them as follows: setMethod("pmax", class_name, function(x, ..., na.rm) { ... }) I use this way to override primitive functions such as min/max and it works fine. But it doesn't work for pmin and pmax. I guess because they are regular functions? How
2014 Nov 12
2
How to maintain memory in R extension
Hello, I wrote a system to perform data analysis in C++. Now I am integrating it to R. I need to allocate memory for my own C++ data structures, which can't be represented by any R data structures. I create a global hashtable to keep a reference to the C++ data structures. Whenever I allocate one, I register it in the hashtable and return its key to the R code. So later on, the R code can
2017 Mar 04
0
can we override "if" in R?
You can. Perhaps needless to say, be careful with this. ? `if` <- function(...) FALSE ? if (TRUE) TRUE else FALSE [1] FALSE G. On Sat, Mar 4, 2017 at 5:36 PM, Da Zheng <zhengda1936 at gmail.com> wrote: > Hello, > > I heard we can override almost everything in R. Is it possible to > override "if" keyword in R to evaluate my own object instead of a > logical
2020 May 31
2
r-project.org SSL certificate issues
On Sat, May 30, 2020 at 11:32 PM G?bor Cs?rdi <csardi.gabor at gmail.com> wrote: [...] > Btw. why does this affect openssl? That root cert was published in > 2010, surely openssl should know about it? Maybe libcurl / openssl > only uses the chain provided by the server? Without trying to use an > alternate chain? Yes, indeed it seems that old OpenSSL versions cannot handle
2020 Jun 09
2
r-project.org SSL certificate issues
Was this resolved upstream or is this something that R should/could fix? If the latter, could this also go into the "emergency release" R 4.0.2 that is scheduled for 2020-06-22? My $.02 /Henrik On Sun, May 31, 2020 at 8:13 AM G?bor Cs?rdi <csardi.gabor at gmail.com> wrote: > > Btw. it would be also possible to create a macOS R installer that > embeds a static or
2011 Nov 22
3
On-demand importing of a package
Dear All, in some functions of my package, I use the Matrix S4 class, as defined in the Matrix package. I don't want to depend on Matrix, however, because my package is perfectly fine without Matrix, most of the functionality does not need Matrix. Matrix is so included in the 'Suggests' line. I load Matrix via require(), from the functions that really need it. This mostly works
2015 Apr 29
2
R CMD check and missing imports from base packages
On Wed, Apr 29, 2015 at 12:53 PM, Winston Chang <winstonchang1 at gmail.com> wrote: > On Tue, Apr 28, 2015 at 3:04 PM, G?bor Cs?rdi <csardi.gabor at gmail.com> > wrote: > > > > > > E.g. if package 'ggplot2' uses 'stats::density()', and package 'igraph' > > also defines 'density()', and 'igraph' is on the search
2019 Apr 30
2
Background R session on Unix and SIGINT
Yeah, I get that they are async. What happens is that the background process is not doing anything when the process gets a SIGINT. I.e. the background process is just listening on its standard input. AFAICT for an interactive process such a SIGINT is just swallowed, with a newline outputted to the terminal. But apparently, for this background process, it is not swallowed, and it is triggered
2017 Dec 05
2
command line arguments are parsed differently on windows, from 3.4.3
Sorry for not reading carefully and thanks for confirming problem with Rscript too. On Dec 5, 2017 08:47, "G?bor Cs?rdi" <csardi.gabor at gmail.com> wrote: > On Tue, Dec 5, 2017 at 4:40 PM, Henrik Bengtsson > <henrik.bengtsson at gmail.com> wrote: > > One comment: > > For your R devel example you didn't use spaces in the expression, i.e. > maybe