Displaying 20 results from an estimated 20 matches for "zhengda1936".
2017 Mar 04
5
can we override "if" in R?
...on(a,b,c) base::`if`(a, b, c)
> ? `if.foo` <- function(a, b, c) FALSE
> ? a <- structure(42, class = "foo")
>
> ? if (a) TRUE else FALSE
> [1] FALSE
>
> ? if (1) TRUE else FALSE
> [1] TRUE
>
> Gabor
>
> On Sat, Mar 4, 2017 at 5:47 PM, Da Zheng <zhengda1936 at gmail.com> wrote:
>> 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".
&...
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
>> my system should execute the existing R code without modific...
2017 Mar 04
2
can we override "if" in R?
...n my own
vectors and matrices directly.
Does this sound reasonable?
Best,
Da
On Sat, Mar 4, 2017 at 3:22 PM, Michael Lawrence
<lawrence.michael at gene.com> wrote:
> 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 gener...
2017 Mar 06
1
can we override "if" in R?
...led out from it, or the
dot-product of two vectors in your system, both of which would be values
(scalars) not matrices.
Now ifelse(), is of course, a different beast altogether, and would need to
be overloaded within your system, I imagine.
Best,
~G
On Sun, Mar 5, 2017 at 12:52 PM, Da Zheng <zhengda1936 at gmail.com> wrote:
> 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...
2017 Mar 04
2
can we override "if" in R?
...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.
>
> ? `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 value?
>>
>> Thanks,
>> Da
>>
>> __________...
2017 Mar 06
0
can we override "if" in R?
...led out from it, or the
dot-product of two vectors in your system, both of which would be values
(scalars) not matrices.
Now ifelse(), is of course, a different beast altogether, and would need to
be overloaded within your system, I imagine.
Best,
~G
On Sun, Mar 5, 2017 at 12:52 PM, Da Zheng <zhengda1936 at gmail.com> wrote:
> 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...
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...
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 not. You can define an `if`...
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 Cs?rdi <csardi.gabor at gmail.com> wrote:
>> `!` is a generic, `if` is not. You can define an `if` that is...
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 it hard...
2017 Mar 04
2
can we override "if" in R?
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 value?
Thanks,
Da
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
2015 Dec 24
0
override pmin/pmax for my own matrix
...{ })
One caveat is that all arguments passed via "..." must derive from the
class specified for "..." in the method signature. At some point we
should solve that by introducing a binary pmin2, pmax2 as we have for
cbind and rbind.
On Thu, Dec 24, 2015 at 5:54 AM, Da Zheng <zhengda1936 at gmail.com> wrote:
> 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 thi...
2017 Jan 27
0
cross-platform portable code in CRAN Repository Policy
...m/project/HenrikBengtsson/globals
/Henrik
PS. Thanks to everyone who made all of the above possible.
On Fri, Jan 27, 2017 at 2:17 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
>
> 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?
> | >
>...
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 value?
>
> Thanks,
> Da
>
> ______________________________________________
>...
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
2015 Jan 31
2
invoking R function in C++ in parallel
Hello,
I'm writing an R extension in C++. In the extension, I want to invoke
an R function directly and it works when I use Rcpp in the serial
code. But what I really want is to invoke the R function in parallel
with openmp. When I do so, I got segmentation fault.
I remember someone said that R isn't thread-safe. I think it's also
understandable because an R function also has
2016 Oct 16
1
compile c++ code in an R package without -g
Hello Dirk,
Thank you very much for your reply.
The main reason I want to remove the debug info is that when I use R
CMD check on my package, it gives the following info
* checking installed package size ... NOTE
installed size is 223.6Mb
sub-directories of 1Mb or more:
libs 223.1Mb
CRAN requires an R package to pass all checks and fix all complaints
including NOTEs.
It seems R's
2016 Oct 16
3
compile c++ code in an R package without -g
Hello,
I'm writing an R package that is mainly written in C++. By default, R
CMD INSTALL creates C/C++ flags as follows:
-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Werror=format-security -D_FORTIFY_SOURCE=2 -g
However, my package is fairly large. With debug info compiled into the
library, the generated .so file is over 200MB. Without debug info,
it's about 30MB. I hope