similar to: how to insert NULLs in lists?

Displaying 20 results from an estimated 9000 matches similar to: "how to insert NULLs in lists?"

2016 Oct 03
4
On implementing zero-overhead code reuse
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 for library code to be accessible to client code is for it to be located in designed directory. No additional meta-files, packaging/compiling, etc. are required. Best, G. On Sun, Oct
2016 Oct 03
3
On implementing zero-overhead code reuse
On Mon, Oct 3, 2016 at 10:18 AM, <frederik at ofb.net> wrote: > Hi Kynn, > > Thanks for expanding. > > I wrote a function like yours when I first started using R. It's > basically the same up to your "new.env()" line, I don't do anything > with environmentns. I just called my function "mysource" and it's > essentially a "source
2016 Oct 02
5
On implementing zero-overhead code reuse
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). (One of the responses I got advised that I post my question here instead.) The
2016 Oct 03
2
On implementing zero-overhead code reuse
On 10/03/2016 01:51 PM, Kynn Jones wrote: > Thank you all for your comments and suggestions. > > @Frederik, my reason for mucking with environments is that I want to > minimize the number of names that import adds to my current > environment. For instance, if module foo defines a function bar, I > want my client code to look like this: > > import("foo") >
2009 May 20
10
How to google for R stuff?
Hi! I'm new to R programming, though I've been programming in other languages for years. One thing I find most frustrating about R is how difficult it is to use Google (or any other search tool) to look for answers to my R-related questions. With languages with even slightly more distinctive names like Perl, Java, Python, Matlab, OCaml, etc., usually including the name of the language
2009 May 19
4
Qs: The list of arguments, wrapping functions...
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 in Perl or the arguments variable in JavaScript. (By "actual" I mean the ones
2012 Dec 15
3
How to speed up the for loop by releasing memeory
Dear list; How can I speed up the run of following code (illustrative) #======================================================================== con<-vector("numeric") for (i in 1:limit) { if(matched data for the ith item found) { if(i==1) {con<-RowOfMatchedData } else {con<-rbind(con,matchedData)} } }
2016 Oct 03
0
On implementing zero-overhead code reuse
Hi Kynn, Thanks for expanding. I wrote a function like yours when I first started using R. It's basically the same up to your "new.env()" line, I don't do anything with environmentns. I just called my function "mysource" and it's essentially a "source with path". That allows me to find code I reuse in standard locations. I don't know why R does not
2009 Jun 25
1
R data inspection under gdb?
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 yet (gdb) p *x $2 = {sxpinfo = {type = 16, obj = 0, named = 0, gp = 0,
2016 Oct 03
0
On implementing zero-overhead code reuse
Thank you all for your comments and suggestions. @Frederik, my reason for mucking with environments is that I want to minimize the number of names that import adds to my current environment. For instance, if module foo defines a function bar, I want my client code to look like this: import("foo") foo$bar(1,2,3) rather than import("foo") bar(1,2,3) (Just a personal
2009 Jun 13
1
conditional dependencies & loading
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 are not required.) Second, what's the best-practice R idiom for such conditional loading?
2009 Jun 12
1
Fast JSON <-> R converter?
Is there a *fast* converter between JSON and R? I'm aware of the rjson package, but it is implemented in R, and it is too slow for my purposes. TIA! kynn [[alternative HTML version deleted]]
2009 Jun 02
1
How to generate R objects in C?
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, unnamed lists, named lists, boolean values, and NA. With the exception of the two types of lists
2009 Jun 12
1
Issues converting from JSON to R
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, "string": "foo",
2009 Jun 26
1
bug in Rf_PrintValue ?
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 */ #include <stdio.h> #include <Rinternals.h> #include
2009 Jun 18
1
ScalarLong?
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]]
2016 Oct 04
0
On implementing zero-overhead code reuse
Check out ?klmr/modules? on Github (distinct 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 <kynnjo at gmail.com> wrote: > I'm looking for a way to approximate the
2009 Jan 19
1
lazy evaluation question
I've been going back to old difficult R-list "evaluation" emails that I save in order to understand evaluation better and below still confuses me. Could someone explain why A) works and B) doesn't. A variant of below is in the Pat's Inferno book also but I'm still not clear on what is happening. Thanks. f <- function() { # FORCING i here doesn't help
2009 Jun 06
1
Qs on calling R from C
Consider the following simple C program: /*** hello_r.c ***/ #include <Rinternals.h> 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./myR/lib64/R/lib -lR hello_r.c -o hello_r > /dev/null % hello_r zsh:
2005 Nov 02
2
Anything like associative arrays in R?
Let me preface my question by stressing that I am much less interested in the answer than in learning a way I could have *found the answer myself*. (As helpful as the participants in this list are, I have far too many R-related questions to resolve by posting here, and as I've written before, in my experience the R documentation has not been very helpful, but I remain hopeful that I may have