Re: [Rd] Holding a large number of SEXPs in C++

2014-11-03 Thread Simon Knapp
t have to read more source? Thanks again for being so awesome, Simon On Tue, Nov 4, 2014 at 12:47 AM, Simon Urbanek wrote: > > On Nov 2, 2014, at 10:55 PM, Simon Knapp wrote: > > > Thanks Simon and sorry for taking so long to give this a go. I had > thought of pair list

Re: [Rd] Holding a large number of SEXPs in C++

2014-11-02 Thread Simon Knapp
PROTECT(currentRegion = CONS(makePolygon(b, e), currentRegion), icr); } SEXP getPolygons(void) { return regions; } private: PROTECT_INDEX ir, icr; SEXP currentRegion, regions; }; Thanks again, Simon Knapp CONS(newPoly, creates a new

[Rd] Holding a large number of SEXPs in C++

2014-10-17 Thread Simon Knapp
ointers in the vectors, but omitted that for the sake of clarity. Is there some other R type that would be suited to this, or a general approach? Cheers and thanks in advance, Simon Knapp [[alternative HTML version deleted]] __ R-devel@r-proje

[Rd] Define 'in' for new class

2014-08-11 Thread Simon Knapp
Hi List, Is it possible to define how 'in' works for an object of a specific class (to achieve a similar result to implementing the iterator protocol in a class Python)? Cheers, Simon Knapp [[alternative HTML version deleted]] __

Re: [Rd] Problem with distributing data in package.

2013-07-20 Thread Simon Knapp
--help`, there is no mention of it in R-exts.pdf and my ability to use Google is clearly lacking... though I did try that), but it appears to be exactly what I need - Thankyou! Kind Regar

Re: [Rd] Problem with distributing data in package.

2013-07-20 Thread Simon Knapp
windows binary package (.R files) if anyone can tell me. Thanks again, Simon On Sat, Jul 20, 2013 at 4:58 PM, Barry Rowlingson wrote: > On Fri, Jul 19, 2013 at 10:33 AM, Simon Knapp wrote: >> Hi List, >> >> I am building a package for a client to help them create and perform &g

[Rd] Problem with distributing data in package.

2013-07-19 Thread Simon Knapp
is there another 'R-ish' way to achieve a similar result? Just in case it is useful, I have included the code I use to build the netcdf file and 'ncdf' object below. Thanks in advance, Simon Knapp #--R code starts here-- #

[Rd] Strange behaviour in as.Date

2012-11-06 Thread Simon Knapp
Defining the wrapper: as.Date.character <- function(x, format='', ...) { if(format=='') base::as.Date.character(x, ...) else base::as.Date.character(x, format=format, ...) } provides (what I think is) the expected behaviour. ... is this the righ

Re: [Rd] Question about copying arguments in C.

2012-09-15 Thread Simon Knapp
nek wrote: > > On Sep 15, 2012, at 2:57 PM, Simon Urbanek wrote: > >> >> On Sep 15, 2012, at 11:28 AM, Simon Knapp wrote: >> >>> Hi Simon, >>> >>> Thanks for your advice, but I'm still not clear. In my case I don't >>> want to m

Re: [Rd] Question about copying arguments in C.

2012-09-15 Thread Simon Knapp
the first case above) or does this leave it unprotected? Thanx again for your help, Simon On Sat, Sep 15, 2012 at 10:40 PM, Simon Urbanek wrote: > > On Sep 14, 2012, at 11:10 PM, Simon Knapp wrote: > >> Hi List, >> >> I'd imagine this is a question that has b

[Rd] Question about copying arguments in C.

2012-09-14 Thread Simon Knapp
Hi List, I'd imagine this is a question that has been answered before, but I can't seem to track it down, sorry for the duplication if it has. I am writing an interface for a C library and want to return an S4 class from the 'constructing' method. One of the slots of the argument to be returned w

Re: [Rd] Questions about imports to a namespace

2012-07-04 Thread Simon Knapp
z[x] }, x, c(NA, x[-length(x)]), MoreArgs = list(z), SIMPLIFY=F) where x is a list (and z a vector). One should really make the test "if(length(y) > 1 && !is.na(y))"... but is there a nicer way? Thanks again, Simion On Tue, Jul 3, 2012 at 8:41 PM, Duncan Murdoch wrote: > On

[Rd] Questions about imports to a namespace

2012-07-02 Thread Simon Knapp
, which my package depends on. Should I do it? 6) I am used to writing 'requires(package)' for each package I use within a function. If I have used import or importFrom in my NAMESPACE, should I still do this? Looking forward to your advice, Simon Knapp

Re: [Rd] array extraction

2011-09-27 Thread Simon Knapp
a[M] gives the same as your `cobbled together' code. On Wed, Sep 28, 2011 at 6:35 AM, robin hankin wrote: > hello everyone. > > Look at the following R idiom: > > a <- array(1:30,c(3,5,2)) > M <- (matrix(1:15,c(3,5)) %% 4) < 2 > a[M,] <- 0 > > Now, I think that "a[M,]" has an unambiguous meani

[Rd] Problems embedding R.

2006-06-17 Thread Simon Knapp
Hi List, I am trying to come to terms with embedding R. I have looked in writing R extensions and a pdf slideshow (by Simon Urbanek) I found on the web and by my reckoning the following should almost work (I use function Rf_initEmbeddedR in the file winembed.c from the Rserv source to initialise

[Rd] Blocking problem with embeded R (windows)

2005-12-09 Thread Simon Knapp
eading the code. Is there any doco on around on these and the R source in general? Thanks again for the rapid reply Simon Knapp __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

[Rd] Blocking problem with embeded R (windows)

2005-12-09 Thread Simon Knapp
re is some way to make my application block when configuring R? If not, is there a simple way to make the app block (I have never coded using threads before, am a relative newbie to MFC and am struggling to figure out how I would to block otherwise). Help would be greatly