[Rd] New S3 methods for optional package

2012-05-24 Thread Jon Olav Skoien
Hi, I have asked this question before, but the solution I ended up with (see below) creates a note when running R CMD check. So I am trying again... I am developing a package B that, among other things, also offers some extra S3-methods for functions in package A if the user has installed A.

Re: [Rd] New S3 methods for optional package

2012-05-24 Thread Prof Brian Ripley
On 24/05/2012 10:38, Jon Olav Skoien wrote: Hi, I have asked this question before, but the solution I ended up with (see below) creates a note when running R CMD check. So I am trying again... I am developing a package B that, among other things, also offers some extra S3-methods for functions

Re: [Rd] Curry: proposed new functional programming, er, function.

2012-05-24 Thread Yike Lu
Hadley Wickham-2 wrote Curry - function(FUN, ...) { args - match.call(expand.dots = FALSE)$... args$... - as.name(...) env - parent.frame() if (is.name(FUN)) { fname - FUN } else if (is.character(FUN)) { fname - as.name(FUN) }

Re: [Rd] Expected behaviour of is.unsorted?

2012-05-24 Thread Matthew Dowle
Duncan Murdoch murdoch.duncan at gmail.com writes: On 12-05-23 4:37 AM, Matthew Dowle wrote: Hi, I've read ?is.unsorted and searched. Have found a few items but nothing close, yet. Is the following expected? is.unsorted(data.frame(1:2)) [1] FALSE is.unsorted(data.frame(2:1))

Re: [Rd] New S3 methods for optional package

2012-05-24 Thread Jon Olav Skoien
Dear Prof. Ripley, Thanks a lot for your answers! See inline comments below. On 24-May-12 12:01, Prof Brian Ripley wrote: On 24/05/2012 10:38, Jon Olav Skoien wrote: I have listed A under Suggests, and have a .onLoad function in B with if (require(A)) registerS3methods(newMethodsMatrix,

Re: [Rd] Expected behaviour of is.unsorted?

2012-05-24 Thread Matthew Dowle
Duncan Murdoch murdoch.duncan at gmail.com writes: On 12-05-24 7:39 AM, Matthew Dowle wrote: Duncan Murdochmurdoch.duncanat gmail.com writes: On 12-05-23 4:37 AM, Matthew Dowle wrote: Since it seems to have a bug anyway (and if so, can't be correct in anyone's use of it), could

Re: [Rd] Expected behaviour of is.unsorted?

2012-05-24 Thread Duncan Murdoch
On 24/05/2012 9:15 AM, Matthew Dowle wrote: Duncan Murdochmurdoch.duncanat gmail.com writes: On 12-05-24 7:39 AM, Matthew Dowle wrote: Duncan Murdochmurdoch.duncanat gmail.com writes: On 12-05-23 4:37 AM, Matthew Dowle wrote: Since it seems to have a bug anyway (and if

Re: [Rd] Expected behaviour of is.unsorted?

2012-05-24 Thread Matthew Dowle
On 24/05/2012 9:15 AM, Matthew Dowle wrote: Duncan Murdochmurdoch.duncanat gmail.com writes: On 12-05-24 7:39 AM, Matthew Dowle wrote: Duncan Murdochmurdoch.duncanat gmail.com writes: On 12-05-23 4:37 AM, Matthew Dowle wrote: Since it seems to have a bug anyway (and

Re: [Rd] Expected behaviour of is.unsorted?

2012-05-24 Thread Duncan Murdoch
On 24/05/2012 11:10 AM, Matthew Dowle wrote: On 24/05/2012 9:15 AM, Matthew Dowle wrote: Duncan Murdochmurdoch.duncanat gmail.com writes: On 12-05-24 7:39 AM, Matthew Dowle wrote: Duncan Murdochmurdoch.duncanatgmail.comwrites: On 12-05-23 4:37 AM,

[Rd] modifying some package code

2012-05-24 Thread Charles Determan Jr
Greetings, I am working on modifying some code from the nlme package. I have had many discussions on the mixed models mailing list and have been directed to simply 'hack' the source code to have the degrees of freedom generated by one function to use in the output of another function that

Re: [Rd] modifying some package code

2012-05-24 Thread Simon Urbanek
On May 24, 2012, at 12:25 PM, Charles Determan Jr wrote: Greetings, I am working on modifying some code from the nlme package. I have had many discussions on the mixed models mailing list and have been directed to simply 'hack' the source code to have the degrees of freedom generated by

Re: [Rd] modifying some package code

2012-05-24 Thread Charles Determan Jr
Simon, Thank you for this valuable information. However, you must forgive some ignorance on my part. If R-registerRoutines defines the native function, how should I go about fixing this issue? Would I copy the init.c to the base package (where I have the new function)? Thanks, Charles On

Re: [Rd] Expected behaviour of is.unsorted?

2012-05-24 Thread Matthew Dowle
On 24/05/2012 11:10 AM, Matthew Dowle wrote: On 24/05/2012 9:15 AM, Matthew Dowle wrote: Duncan Murdochmurdoch.duncanat gmail.com writes: On 12-05-24 7:39 AM, Matthew Dowle wrote: Duncan Murdochmurdoch.duncanatgmail.comwrites: On 12-05-23 4:37

Re: [Rd] modifying some package code

2012-05-24 Thread Simon Urbanek
On May 24, 2012, at 1:26 PM, Charles Determan Jr wrote: Simon, Thank you for this valuable information. However, you must forgive some ignorance on my part. If R-registerRoutines defines the native function, how should I go about fixing this issue? Would I copy the init.c to the base

Re: [Rd] Expected behaviour of is.unsorted?

2012-05-24 Thread Duncan Murdoch
On 24/05/2012 1:33 PM, Matthew Dowle wrote: On 24/05/2012 11:10 AM, Matthew Dowle wrote: On 24/05/2012 9:15 AM, Matthew Dowle wrote: Duncan Murdochmurdoch.duncanatgmail.comwrites: On 12-05-24 7:39 AM, Matthew Dowle wrote: Duncan

[Rd] columnames changes behaviour of formula

2012-05-24 Thread robin hankin
Hello. precompiled R-2.15.0, svn58871, macosx 10.7.4. I have discovered that defining column names of a dataframe can alter the behaviour of lm(): d - c(4,7,6,4) x - data.frame(cbind(0:3,5:2)) coef(lm(d~ -1 + (.)^2,data=x)) X1X2 X1:X2 -1.77 0.83 1.25 R R OK, so far so good. But

Re: [Rd] columnames changes behaviour of formula

2012-05-24 Thread Joshua Wiley
Hi Robin, Seems like the intended behavior to me. From the docs: There are two special interpretations of '.' in a formula. The usual one is in the context of a 'data' argument of model fitting functions and means 'all columns not otherwise in the formula' d is in the formula so the only

Re: [Rd] columnames changes behaviour of formula

2012-05-24 Thread Joshua Wiley
P.S. It really is sloppy code to mix variables from the global environment with those inside a data frame. I.e.: coef(lm(d ~ -1 + (.)^2, data = x)) the only time I think it makes sense to have different objects for the outcome and predictors are when for speed purposes, you are using a low level