Re: [Rd] Bugs? when dealing with contrasts

2010-04-21 Thread Peter Dalgaard
Gabor Grothendieck wrote: > On Wed, Apr 21, 2010 at 4:26 PM, Peter Dalgaard wrote: ... >> I.e., that R reverts to using indicator variables when the intercept is >> absent. > > Is there any nice way of getting contr.sum coding for the interaction > as opposed to the ugly code in my post that I us

Re: [Rd] Bugs? when dealing with contrasts

2010-04-21 Thread Gabor Grothendieck
On Wed, Apr 21, 2010 at 11:38 PM, Berwin A Turlach wrote: >> > # But I was expecting this since I am using contr.sum >> > cbind(1, model.matrix(~ fac)[,2:3] * scores) >>      fac1 fac2 >> 1  1   -2    0 >> 2  1   -1    0 >> 3  1    0    0 >> 4  1    1    0 >> 5  1    2    0 >> 6  1    0   -2 >> 7

Re: [Rd] Bugs? when dealing with contrasts

2010-04-21 Thread Berwin A Turlach
G'day Gabor, On Wed, 21 Apr 2010 14:00:33 -0400 Gabor Grothendieck wrote: > Below are two cases where I don't seem to be getting contr.sum > contrasts even though they were specified. Are these bugs? Short answer: no. :) > The first case is an interaction between continuous and factor > varia

[Rd] Question of R CMD check

2010-04-21 Thread rusers.sh
Hi all, Today, i just installed the newest R version 2.10.1 and other necessary tools for building R package under windows,e.g. Rtools, perl. All are the newest version. After the correct configuration under windows (configuration should be correct), i use it to re-check my old package. I fou

[Rd] RUnit bug?

2010-04-21 Thread Dominick Samperi
There appears to be a bug in RUnit. Given a testsuite testsuite.math, say, when I run: runTestSuite(testsuite.math) this works fine, provided there are no extraneous files in the unit test subdirectory. But if there are any Emacs temp files (with names that end with '~') then runTestSuite gets

Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-21 Thread William Dunlap
If I were worried about the time this loop takes, I would avoid using i%nt. For the attached C code compile with gcc 4.3.3 with -O2 I get > # INTEGER() in loop > system.time( r1 <- .Call("my_rep1", 1:3, 1e7) ) user system elapsed 0.060 0.012 0.071 > # INTEGER() before loop

Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-21 Thread Simon Urbanek
On Apr 21, 2010, at 4:39 PM, Simon Urbanek wrote: > > On Apr 21, 2010, at 4:13 PM, Romain Francois wrote: > >> Le 21/04/10 21:39, Simon Urbanek a écrit : >>> >>> >>> On Apr 21, 2010, at 3:32 PM, Romain Francois wrote: >>> Le 21/04/10 17:54, Matthew Dowle a écrit : > >> From cop

Re: [Rd] Bugs? when dealing with contrasts

2010-04-21 Thread Gabor Grothendieck
On Wed, Apr 21, 2010 at 4:26 PM, Peter Dalgaard wrote: > As for case #1, the rules are tricky in cases where interactions are > present without main effects, but AFAICS, what you observe is > essentially the same effect as > >> model.matrix(~fac-1, contrasts=list(fac="contr.sum")) >   fac1 fac2 fa

Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-21 Thread Simon Urbanek
On Apr 21, 2010, at 4:13 PM, Romain Francois wrote: > Le 21/04/10 21:39, Simon Urbanek a écrit : >> >> >> On Apr 21, 2010, at 3:32 PM, Romain Francois wrote: >> >>> Le 21/04/10 17:54, Matthew Dowle a écrit : > From copyVector in duplicate.c : void copyVector(SEXP s, SEXP t

Re: [Rd] Bugs? when dealing with contrasts

2010-04-21 Thread Peter Dalgaard
Gabor Grothendieck wrote: > R version 2.10.1 (2009-12-14) > Copyright (C) 2009 The R Foundation for Statistical Computing > ISBN 3-900051-07-0 > > R is free software and comes with ABSOLUTELY NO WARRANTY. > You are welcome to redistribute it under certain conditions. > Type 'license()' or 'licence

Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-21 Thread Romain Francois
Le 21/04/10 21:39, Simon Urbanek a écrit : On Apr 21, 2010, at 3:32 PM, Romain Francois wrote: Le 21/04/10 17:54, Matthew Dowle a écrit : From copyVector in duplicate.c : void copyVector(SEXP s, SEXP t) { int i, ns, nt; nt = LENGTH(t); ns = LENGTH(s); switch (TYPEOF(

Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-21 Thread Simon Urbanek
On Apr 21, 2010, at 3:32 PM, Romain Francois wrote: > Le 21/04/10 17:54, Matthew Dowle a écrit : >> >>> From copyVector in duplicate.c : >> >> void copyVector(SEXP s, SEXP t) >> { >> int i, ns, nt; >> nt = LENGTH(t); >> ns = LENGTH(s); >> switch (TYPEOF(s)) { >> ... >> case

Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-21 Thread Simon Urbanek
On Apr 21, 2010, at 2:15 PM, Seth Falcon wrote: > On 4/21/10 10:45 AM, Simon Urbanek wrote: >> Won't that miss the last incomplete chunk? (and please don't use >> DATAPTR on INTSXP even though the effect is currently the same) >> >> In general it seems that the it depends on nt whether this is >

Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-21 Thread Romain Francois
Le 21/04/10 17:54, Matthew Dowle a écrit : From copyVector in duplicate.c : void copyVector(SEXP s, SEXP t) { int i, ns, nt; nt = LENGTH(t); ns = LENGTH(s); switch (TYPEOF(s)) { ... case INTSXP: for (i = 0; i< ns; i++) INTEGER(s)[i] = INTEGER(t)[i % nt]

Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-21 Thread Seth Falcon
On 4/21/10 10:45 AM, Simon Urbanek wrote: Won't that miss the last incomplete chunk? (and please don't use DATAPTR on INTSXP even though the effect is currently the same) In general it seems that the it depends on nt whether this is efficient or not since calls to short memcpy are expensive (ver

[Rd] Bugs? when dealing with contrasts

2010-04-21 Thread Gabor Grothendieck
R version 2.10.1 (2009-12-14) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural

Re: [Rd] suggestion how to use memcpy in duplicate.c

2010-04-21 Thread Simon Urbanek
Matt, On Apr 21, 2010, at 11:54 AM, Matthew Dowle wrote: >> From copyVector in duplicate.c : > > void copyVector(SEXP s, SEXP t) > { >int i, ns, nt; >nt = LENGTH(t); >ns = LENGTH(s); >switch (TYPEOF(s)) { > ... >case INTSXP: >for (i = 0; i < ns; i++) >INTEGER(s)[i

[Rd] suggestion how to use memcpy in duplicate.c

2010-04-21 Thread Matthew Dowle
>From copyVector in duplicate.c : void copyVector(SEXP s, SEXP t) { int i, ns, nt; nt = LENGTH(t); ns = LENGTH(s); switch (TYPEOF(s)) { ... case INTSXP: for (i = 0; i < ns; i++) INTEGER(s)[i] = INTEGER(t)[i % nt]; break; ... could that be replaced with : c

Re: [Rd] Serial connections?

2010-04-21 Thread Philippe Grosjean
Simon, I see what you mean, and I agree it would be nice to have a connection. That would be the natural way in S. Yet, connections are driven by R. You cannot open a connection and let the connected device trigger some R code when data is available, don't you? Otherwise, I don't understand

Re: [Rd] Serial connections?

2010-04-21 Thread Simon Urbanek
Philippe, unfortunately that approach has one major drawback - it does not give you a connection. As I said in the previous e-mail it is fairly easy to talk to a tty directly, but the challenge is to turn it into a connection. I don't like the Tcl approach for several reasons, one of them being

[Rd] New CRAN test platform - Sparc Solaris

2010-04-21 Thread Prof Brian Ripley
The CRAN package check page now shows results on Sparc Solaris 10 using a server donated by Sun. This box tests several different aspects from the existing Intel-based test boxes: - the CPU is big-endian. - it does not have extended-precision doubles in FPU registers. (It does support long

Re: [Rd] Serial connections?

2010-04-21 Thread Philippe Grosjean
There is another option I use since a couple of years to pilot scientific devices, to program my chemostats, etc. and that is platform-independent: Tcl. Tcl i/o design is excellent and very robust, and Tcl/Tk is integrated in R with the tcltk package. It is really just a mather of a few line