Re: [Rd] On implementing zero-overhead code reuse

2016-10-04 Thread Kynn Jones
ct from CRAN’s ‹modules›!). It > looks pretty much exactly like what you want: > > https://github.com/klmr/modules > > It has an extensive README and vignette explaining the usage. > > Cheers, > Konrad > > -- > Konrad Rudolph > On Sun, 2 Oct 2016 at 18:31 Kynn Jones

Re: [Rd] On implementing zero-overhead code reuse

2016-10-03 Thread Kynn Jones
Martin, thanks for that example. It's definitely eye-opening, and very good to know. The installation business, however, is still a killer for me. Of course, it's a trivial step in a simple example like the one you showed. But consider this scenario: suppose I perform an analysis that I may pu

Re: [Rd] On implementing zero-overhead code reuse

2016-10-03 Thread Kynn Jones
k's take is interesting. I don't use version control for my >> personal projects, just backing-up. Obviously not all R users are >> interested in becoming package maintainers, in fact I think it would >> clutter things a bit if this were the case. Or maybe it would be

Re: [Rd] On implementing zero-overhead code reuse

2016-10-02 Thread Kynn Jones
On Sun, Oct 2, 2016 at 8:01 PM, Kynn Jones wrote: > Hi Frederick, > > I described what I meant in the post I sent to R-help > (https://stat.ethz.ch/pipermail/r-help/2016-September/442174.html), > but in brief, by "zero overhead" I mean that the only thing needed

Re: [Rd] On implementing zero-overhead code reuse

2016-10-02 Thread Kynn Jones
t not sure. > > Thank you, > > Frederick > > On Sun, Oct 02, 2016 at 01:29:52PM -0400, Kynn Jones wrote: >> I'm looking for a way to approximate the "zero-overhead" model of code >> reuse available in languages like Python, Perl, etc. >> >> I'

[Rd] On implementing zero-overhead code reuse

2016-10-02 Thread Kynn Jones
I'm looking for a way to approximate the "zero-overhead" model of code reuse available in languages like Python, Perl, etc. I've described this idea in more detail, and the motivation for this question in an earlier post to R-help (https://stat.ethz.ch/pipermail/r-help/2016-September/442174.html).

[Rd] bug in Rf_PrintValue ?

2009-06-26 Thread Kynn Jones
I'm very green with R, so maybe this is not a bug, but it looks like one to me. The following program segfaults at the second call to Rf_PrintValue(). To failure depends on the value of the y-string. E.g., if I change it from "coverage" to, say, "COVERAGE", the segfault does not occur. /* bug.c

Re: [Rd] R data inspection under gdb?

2009-06-26 Thread Kynn Jones
Thanks, that was very helpful! Kynn On Thu, Jun 25, 2009 at 6:05 PM, Martin Morgan wrote: > Hi Kynn -- > > (gdb) call Rf_PrintValue(x) > > 'void' is I think the return value of R_PV() > > Martin > > Kynn Jones wrote: > > Hi, everyone. I'm tr

[Rd] R data inspection under gdb?

2009-06-25 Thread Kynn Jones
Hi, everyone. I'm trying to debug an R-module, written in C, and I'm using gdb for this. How can I print "standard" R objects from within C code? BTW, I'm familiar with the advice to use R_PV given in Writing R Extensions, but it's not working for me. E.g., I get (gdb) p R_PV(x) $1 = void and

[Rd] ScalarLong?

2009-06-18 Thread Kynn Jones
I was surprised to see that there is a ScalarInteger function in Rinlinedfuns.h, but nothing like ScalarLong. How can one create an R-integer from a C long? TIA! kynn [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list

[Rd] conditional dependencies & loading

2009-06-13 Thread Kynn Jones
Hi! I'm working on a package that must convert data to and from JSON. For this, it can use either the rjson package, or preferably, the faster RJSONIO package. I have two related questions about this. First, how can I specify that the package depends on *either* RJSONIO *or* rjson? (I.e. both

[Rd] Issues converting from JSON to R

2009-06-12 Thread Kynn Jones
When converting from JSON to R it seems logical that a JSON array would correspond to an "unnamed" R list, while a JSON object would correspond to a "named" R list. E.g. JSON: [1, 3.1415927, "foo", false, null] => R: list(1, 3.1415927, "foo", FALSE, NA); and JSON { "int": 1, "float": 3.1415927

[Rd] How to explore R internals through gdb?

2009-06-08 Thread Kynn Jones
Hi everyone. I'm trying to learn my way around the R internals. I've gone pretty much as far as I can go with the information given in Writing R Extensions and R Internals, but I still have a lot of questions, too many in fact to post them to the r-devel list. But I think I could answer many of t

Re: [Rd] Qs on calling R from C

2009-06-06 Thread Kynn Jones
On Sat, Jun 6, 2009 at 5:31 PM, Dirk Eddelbuettel wrote: > > Try reading 'R Extensions' section 8.1 entitled 'Embedding R under > Unix-alikes'. That was just what I needed! All it took was adding a single line before the call to mkString (and adding one more header file): #include #include

[Rd] Qs on calling R from C

2009-06-06 Thread Kynn Jones
Consider the following simple C program: /*** hello_r.c ***/ #include SEXP hello() { return mkString("Hello, world!\n"); } int main(void) { SEXP x = hello(); return x == NULL; /* i.e. 0 on success */ } This program segfaults: % myR/bin/R CMD LINK gcc -I./R-2.9.0/src/include -L.

Re: [Rd] need help with libtool/aclocal error

2009-06-06 Thread Kynn Jones
On Sat, Jun 6, 2009 at 5:58 AM, Prof Brian Ripley wrote: > ...or just > updating tools/ltmain.sh from > https://svn.r-project.org/R/branches/R-2-9-branch/tools/ltmain.sh and > re-configuring and re-making R. Thanks, that worked like a charm. __ R-devel

[Rd] need help with libtool/aclocal error

2009-06-05 Thread Kynn Jones
I'm trying to build an executable for a program I wrote. The compilation steps go well, but the linking step fails with a libtool "version mismatch" error. My linking command has this prefix: /path/to/R/bin/R CMD LINK gcc -g -std=gnu99 ... etc. The error looks like this: libtool: Version misma

[Rd] How to generate R objects in C?

2009-06-02 Thread Kynn Jones
I'm in the process of coding a parser (in C) to generate R entities (vectors, lists, etc.) from a text description (different from R). The basic parser works, and now I need to tell it how to create R entities. I need to be able to create character vectors (for unicode strings), integers, floats,

Re: [Rd] Can a function know what other function called it?

2009-05-23 Thread Kynn Jones
On Sat, May 23, 2009 at 4:55 PM, Robert Gentleman wrote: > Hi Kynn, > > > Kynn Jones wrote: >> Suppose function foo calls function bar.  Is there any way in which >> bar can find out the name of the function that called it, "foo"? > >  essentially yes.

[Rd] Can a function know what other function called it?

2009-05-23 Thread Kynn Jones
Suppose function foo calls function bar. Is there any way in which bar can find out the name of the function that called it, "foo"? There are two generalization to this question that interest me. First, can this query go farther up the call stack? I.e. if bar now calls baz, can baz find out the

Re: [Rd] Qs: The list of arguments, wrapping functions...

2009-05-19 Thread Kynn Jones
Thanks for your replies! The will require some study on my part, which is good: a lot to learn. KJ [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

[Rd] Qs: The list of arguments, wrapping functions...

2009-05-19 Thread Kynn Jones
Hi. I'm pretty new to R, but I've been programming in other languages for some time. I have a couple of questions regarding programming with function objects. 1. Is there a way for a function to refer generically to all its actual arguments as a list? I'm thinking of something like the @_ array