Re: [Rd] cut.POSIXt problem with breaks= "quarter" (PR#14162)

2009-12-23 Thread Prof Brian Ripley
What exactly is the purported bug here?  It seems to me that the cuts 
are correct and the behaiour is as documented, but that you were not 
expecting empty levels.  If that bothers you, use


cut(x, breaks= "quarter")[,drop=TRUE]


On Mon, 21 Dec 2009, shmu...@googlemail.com wrote:


Full_Name: Qing Xia
Version: 2.10.0
OS: Windows XP
Submission from: (NULL) (213.71.23.233)


I find, when I use "cut" function to cut date-time objects based on breaks =
"quarter", there exists a problem. It means, if the date-time has "-MM-30"
or "-MM-31", then "cut" runs not correctly, it gives wrong levels. Detail
can be found in the following R-Output:

1. correct Output levels, if there is no date-time "-MM-30" or "-MM-31"


x<- as.Date(c("2009-03-21","2009-03-24"))
cut(x, breaks= "quarter")

[1] 2009-01-01 2009-01-01
Levels: 2009-01-01


2. wrong Output levels, if there exists date-time "-MM-30" or "-MM-31"


x<- as.Date(c("2009-03-21","2009-03-30"))
cut(x, breaks= "quarter")

[1] 2009-01-01 2009-01-01
Levels: 2009-01-01 2009-04-01



x<- as.Date(c("2009-03-21","2009-03-31"))
cut(x, breaks= "quarter")

[1] 2009-01-01 2009-01-01
Levels: 2009-01-01 2009-04-01

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] as.Date function yields inconsistent results (PR#14166)

2009-12-23 Thread diverses
Full_Name: Mario Luoni
Version: 2.10.0
OS: Windows XP HE SP3
Submission from: (NULL) (217.194.59.134)


This piece of code:

zzz1 <- as.POSIXct("1999-03-18", tz="CET")
zzz2 <- as.POSIXlt("1999-03-18", tz="CET")
zzz1 == zzz2
as.Date(zzz1)
as.Date(zzz2)

yields TRUE for "zzz1==zzz2", but the two dates returned by as.Date are 
different:

> as.Date(zzz1)
[1] "1999-03-17"
> as.Date(zzz2)
[1] "1999-03-18"

For me this looks like a bug, even though it could be a problem with timezones,
but I couldn't find documentation that would explain that behaviour.


> sessionInfo()
R version 2.10.0 (2009-10-26) 
i386-pc-mingw32 

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252  

[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C 

[5] LC_TIME=English_United States.1252

attached base packages:
[1] grDevices datasets  splines   graphics  stats tcltk utils
methods   base 

other attached packages:
[1] svSocket_0.9-48 TinnR_1.0.3 R2HTML_1.59-1   Hmisc_3.7-0
survival_2.35-7

loaded via a namespace (and not attached):
[1] cluster_1.12.1  grid_2.10.0 lattice_0.17-26 svMisc_0.9-56   tools_2.10.0

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] sort yields different results on OS X (PR#14163)

2009-12-23 Thread Jeffrey M Sullivan

On Dec 22, 2009, at 4:18 AM, Prof Brian Ripley wrote:


As the help says

The sort order for character vectors will depend on the collating
sequence of the locale in use: see ‘Comparison’.

and that ref says

Collation of
non-letters (spaces, punctuation signs, hyphens, fractions and so
on) is even more problematic.

That different OSes use the same name for a locale does not make  
them the same locale.


Note that R can be compiled to use ICU, which provides a well- 
considered collation suite.  R on Mac OS X uses ICU, as does a Linux  
build if it is available -- so I would say that it is RHEL that is  
out of line here (it makes little sense to have < and > far apart in  
the collation sequence).


Why did you report a documented difference as a bug?



Because it wasn't clear to me from the documentation what sort of  
"problematic" behaviors were covered as documented differences vs  
unexpected behavior. Other OSS projects I have been involved with have  
a "when in doubt, file a bug" policy. If that isn't the case with R, I  
won't do so in the future.


Thank you for the pointer towards ICU. RHEL has some of the ICU  
libraries, but the icuSetCollate function returns a warning that R was  
not built with them. Including a reference to this function in the  
"See Also" for Comparison would make this info a little easier to find.


Thanks for your time,
Jeff


On Mon, 21 Dec 2009, jeffr...@rand.org wrote:


Full_Name: Jeffrey Sullivan
Version: 2.10
OS: Mac
Submission from: (NULL) (130.154.0.250)


Sort produces different results when sorting strings with non- 
alphanumeric

characters, depending on the operating system:

RHEL 5.2, R 2.10.0
-

v <- c("1","<0",">3","2")
Sys.setlocale("LC_COLLATE","en_US.UTF-8")

[1] "en_US.UTF-8"

sort(v)

[1] "<0" "1"  "2"  ">3"

Max OS 10.5.8, R 2.10.1
---

v <- c("1","<0",">3","2")
Sys.setlocale("LC_COLLATE","en_US.UTF-8")

[1] "en_US.UTF-8"

sort(v)

[1] "<0" ">3" "1"  "2"

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595


--
Jeffrey Sullivan
Senior Project Associate
RAND Corporation

Work : (310) 393-0411 x6883
Fax  : (310) 260-8147
SIPR : jeffr...@sm.rand.pentagon.smil.mil
JWICS: sulliv...@la.ic.gov


__

This email message is for the sole use of the intended r...{{dropped:8}}

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Rcpp: Clarifying the meaning of GPL?

2009-12-23 Thread Stavros Macrakis
On Wed, Dec 23, 2009 at 12:27 AM, Dominick Samperi
wrote:

> Stavros Macrakis wrote:
>
>> That said, as a matter of courtesy and clarity, I'd think that a fork
>> should use a different name.
>>
> Yes, the point is that this is not a legal or technical matter, it is a
> matter of professional courtesy.
>
> I take this as one vote for the name change.
>

The naming and maintenance history of this package (or these packages: Rcpp
and RcppTemplate) appears to be complicated, and I have no interest in
becoming an arbitrator or voter in what is a dispute between you and other
implementers.


> On US copyright law, this should not be confused with "copyright" notices
> that appear in GPL
> source code. Remember that these are really "copyleft" notices, and
> copyleft is designed to
> protect the rights of copiers, not original contributors.


The copyright notice is a correct and legally valid copyright notice.  The
GPL (copyleft) is the copyright *license*.  Like all licenses, it defines
the relationship between authors and copiers.  The GPL explicitly avoided
the so-called "obnoxious BSD advertising clause", which has requirements
about giving credit.

  -s

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Rcpp: Clarifying the meaning of GPL?

2009-12-23 Thread Dominick Samperi
In my view what has happened is not much different from a situation 
where I place my
name as co-author on a research paper that you have created, without 
your permission,
after making a few small edits that you may not agree with. Furthermore, 
if you complain
I simply present the results (at conferences) as my own without 
mentioning your name.


Is this just a dispute between implementers?

Stavros Macrakis wrote:
On Wed, Dec 23, 2009 at 12:27 AM, Dominick Samperi 
mailto:djsamp...@earthlink.net>> wrote:


Stavros Macrakis wrote:

That said, as a matter of courtesy and clarity, I'd think that
a fork should use a different name.

Yes, the point is that this is not a legal or technical matter, it
is a matter of professional courtesy.

I take this as one vote for the name change.


The naming and maintenance history of this package (or these packages: 
Rcpp and RcppTemplate) appears to be complicated, and I have no 
interest in becoming an arbitrator or voter in what is a dispute 
between you and other implementers.
 


On US copyright law, this should not be confused with "copyright"
notices that appear in GPL
source code. Remember that these are really "copyleft" notices,
and copyleft is designed to
protect the rights of copiers, not original contributors.


The copyright notice is a correct and legally valid copyright notice.  
The GPL (copyleft) is the copyright *license*.  Like all licenses, it 
defines the relationship between authors and copiers.  The GPL 
explicitly avoided the so-called "obnoxious BSD advertising clause", 
which has requirements about giving credit.


  -s



__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] how to catch useDynLib errors? Rgraphviz

2009-12-23 Thread Martin Morgan
Rgraphviz load problems frequently involve a mismatch between the
version of graphviz installed on the user machine, compared to the
version of graphviz used to build the package.

Rgraphviz has a name space with useDynLib(Rgrahpviz), and an .onLoad
function that checks that the versions of the installed and built
graphviz match. Unfortunately, the .onLoad code is only evaluated if
useDynLib succeeds, so in many cases of version mismatch users receive
hard-to-interpret error messages.

Are there any hooks or other solutions available to catch errors during
useDynLib? Or will we have more success using library.dynam in .onLoad?

Thanks in advacne

Martin
-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Rcpp: Clarifying the meaning of GPL?

2009-12-23 Thread Sean O'Riordain
Good afternoon,

While I don't know the history of this particular conflict - to me the
entire *purpose* of the GPL is to ALLOW forking of code which must
remain in public.  If somebody forks code and makes any change
whatsoever and then distributes either the diff or the entire previous
project, then they can (and probably should) add their name as a
copyright holder to the copyrights of previous contributors.  They
cannot however remove previous copyright holders names so easily.

It should be noted that having multiple independent copyright holder
names on a GPL project is normally held as a positive thing - it makes
it much harder to un-GPL the project.

Kind regards,
Sean


On Wed, Dec 23, 2009 at 4:05 PM, Dominick Samperi
 wrote:
> In my view what has happened is not much different from a situation where I
> place my
> name as co-author on a research paper that you have created, without your
> permission,
> after making a few small edits that you may not agree with. Furthermore, if
> you complain
> I simply present the results (at conferences) as my own without mentioning
> your name.
>
> Is this just a dispute between implementers?
>
> Stavros Macrakis wrote:
>>
>> On Wed, Dec 23, 2009 at 12:27 AM, Dominick Samperi
>> mailto:djsamp...@earthlink.net>> wrote:
>>
>>    Stavros Macrakis wrote:
>>
>>        That said, as a matter of courtesy and clarity, I'd think that
>>        a fork should use a different name.
>>
>>    Yes, the point is that this is not a legal or technical matter, it
>>    is a matter of professional courtesy.
>>
>>    I take this as one vote for the name change.
>>
>>
>> The naming and maintenance history of this package (or these packages:
>> Rcpp and RcppTemplate) appears to be complicated, and I have no interest in
>> becoming an arbitrator or voter in what is a dispute between you and other
>> implementers.
>>
>>    On US copyright law, this should not be confused with "copyright"
>>    notices that appear in GPL
>>    source code. Remember that these are really "copyleft" notices,
>>    and copyleft is designed to
>>    protect the rights of copiers, not original contributors.
>>
>>
>> The copyright notice is a correct and legally valid copyright notice.  The
>> GPL (copyleft) is the copyright *license*.  Like all licenses, it defines
>> the relationship between authors and copiers.  The GPL explicitly avoided
>> the so-called "obnoxious BSD advertising clause", which has requirements
>> about giving credit.
>>
>>              -s
>>
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] A package for visualizing R syntax

2009-12-23 Thread Sylvain Loiseau
Dear all,

I have written a small set of functions for drawing graphical representations 
of R objects and evaluations of R expressions.

It is mainly intended for pedagogical purposes. Here are some samples:

http://panini.u-paris10.fr/~sloiseau/sampleGraphics.pdf

The idea is to use some graphical conventions in order to make clear the 
abstract syntax and to explain function, extraction, recycling, type 
conversion, properties of data structures, etc.

I would be very interested in your reactions and comments. I'm wondering if it 
may become a R package. Does something like this already exist? May it be 
useful? What improvement may be planned? Have you some idea for the name of 
such a package (visualR, seeR... ?)

Best regards,
Sylvain
--
Sylvain Loiseau
sylvain.lois...@unicaen.fr

Université de Caen Basse Normandie
Maison de la Recherche en Sciences Humaines
MRSH - SH018
Esplanade de la Paix
Campus 1
14032 Caen Cedex

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Rcpp: Clarifying the meaning of GPL?

2009-12-23 Thread Stavros Macrakis
The central purpose of the GPL license is precisely to allow and indeed
encourage the behavior your are criticizing.  In particular, when you
release software under the GPL, you are *explicitly* giving recipients of
the software the right to modify it pretty much in any way (trivial or
radical) they please and redistribute it by any means they choose (as long
as they redistribute source with binary and maintain the legal notices).
There is no legal or ethical obligation to consult the original author in
any way, or even to acknowledge the original author other than by
maintaining his or her copyright notice.  The only legal obligation is to
maintain the copyright notice and the GPL license itself and to include a
notice that the software has been modified (GPL3 section 5a).

This is not an accident.  The promulgators of the GPL, the FSF, believe that
these are the conditions under which software is best distributed -- that
implementors should be free to combine bits and pieces of software from a
variety of GPL-compatible licenses with no fear of violating any of their
licenses.

Obviously these legal and ethical conditions are quite different from those
which prevail in academic publishing, and if you don't like them, you should
be releasing your software under a different license -- which will probably
have the effect of making your software less useful to the community and
therefore less widely known and used.

   -s


On Wed, Dec 23, 2009 at 11:05 AM, Dominick Samperi
wrote:

> In my view what has happened is not much different from a situation where I
> place my
> name as co-author on a research paper that you have created, without your
> permission,
> after making a few small edits that you may not agree with. Furthermore, if
> you complain
> I simply present the results (at conferences) as my own without mentioning
> your name.
>
> Is this just a dispute between implementers?
>
> Stavros Macrakis wrote:
>
>  On Wed, Dec 23, 2009 at 12:27 AM, Dominick Samperi <
>> djsamp...@earthlink.net > wrote:
>>
>>Stavros Macrakis wrote:
>>
>>That said, as a matter of courtesy and clarity, I'd think that
>>a fork should use a different name.
>>
>>Yes, the point is that this is not a legal or technical matter, it
>>is a matter of professional courtesy.
>>
>>I take this as one vote for the name change.
>>
>>
>> The naming and maintenance history of this package (or these packages:
>> Rcpp and RcppTemplate) appears to be complicated, and I have no interest in
>> becoming an arbitrator or voter in what is a dispute between you and other
>> implementers.
>>
>>On US copyright law, this should not be confused with "copyright"
>>notices that appear in GPL
>>source code. Remember that these are really "copyleft" notices,
>>and copyleft is designed to
>>protect the rights of copiers, not original contributors.
>>
>>
>> The copyright notice is a correct and legally valid copyright notice.  The
>> GPL (copyleft) is the copyright *license*.  Like all licenses, it defines
>> the relationship between authors and copiers.  The GPL explicitly avoided
>> the so-called "obnoxious BSD advertising clause", which has requirements
>> about giving credit.
>>
>>  -s
>>
>>
>

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Rcpp: Clarifying the meaning of GPL?

2009-12-23 Thread Henrik Bengtsson
I guess one problem is who is in charge of the name Rcpp on CRAN.  For
instance, can I "fork" of yet another version of Rcpp (or any other
CRAN package) and submit it to CRAN?  Can the original author submit a
completely different Rcpp package breaking all the additions made by
the new contributors?  I don't think the GPL answers those questions,
but maybe there is something on the ownership to the (original)
"title/label/name/identifier" of a GPL artifact.

My $.02

/Henrik

On Wed, Dec 23, 2009 at 1:00 PM, Stavros Macrakis  wrote:
> The central purpose of the GPL license is precisely to allow and indeed
> encourage the behavior your are criticizing.  In particular, when you
> release software under the GPL, you are *explicitly* giving recipients of
> the software the right to modify it pretty much in any way (trivial or
> radical) they please and redistribute it by any means they choose (as long
> as they redistribute source with binary and maintain the legal notices).
> There is no legal or ethical obligation to consult the original author in
> any way, or even to acknowledge the original author other than by
> maintaining his or her copyright notice.  The only legal obligation is to
> maintain the copyright notice and the GPL license itself and to include a
> notice that the software has been modified (GPL3 section 5a).
>
> This is not an accident.  The promulgators of the GPL, the FSF, believe that
> these are the conditions under which software is best distributed -- that
> implementors should be free to combine bits and pieces of software from a
> variety of GPL-compatible licenses with no fear of violating any of their
> licenses.
>
> Obviously these legal and ethical conditions are quite different from those
> which prevail in academic publishing, and if you don't like them, you should
> be releasing your software under a different license -- which will probably
> have the effect of making your software less useful to the community and
> therefore less widely known and used.
>
>               -s
>
>
> On Wed, Dec 23, 2009 at 11:05 AM, Dominick Samperi
> wrote:
>
>> In my view what has happened is not much different from a situation where I
>> place my
>> name as co-author on a research paper that you have created, without your
>> permission,
>> after making a few small edits that you may not agree with. Furthermore, if
>> you complain
>> I simply present the results (at conferences) as my own without mentioning
>> your name.
>>
>> Is this just a dispute between implementers?
>>
>> Stavros Macrakis wrote:
>>
>>  On Wed, Dec 23, 2009 at 12:27 AM, Dominick Samperi <
>>> djsamp...@earthlink.net > wrote:
>>>
>>>    Stavros Macrakis wrote:
>>>
>>>        That said, as a matter of courtesy and clarity, I'd think that
>>>        a fork should use a different name.
>>>
>>>    Yes, the point is that this is not a legal or technical matter, it
>>>    is a matter of professional courtesy.
>>>
>>>    I take this as one vote for the name change.
>>>
>>>
>>> The naming and maintenance history of this package (or these packages:
>>> Rcpp and RcppTemplate) appears to be complicated, and I have no interest in
>>> becoming an arbitrator or voter in what is a dispute between you and other
>>> implementers.
>>>
>>>    On US copyright law, this should not be confused with "copyright"
>>>    notices that appear in GPL
>>>    source code. Remember that these are really "copyleft" notices,
>>>    and copyleft is designed to
>>>    protect the rights of copiers, not original contributors.
>>>
>>>
>>> The copyright notice is a correct and legally valid copyright notice.  The
>>> GPL (copyleft) is the copyright *license*.  Like all licenses, it defines
>>> the relationship between authors and copiers.  The GPL explicitly avoided
>>> the so-called "obnoxious BSD advertising clause", which has requirements
>>> about giving credit.
>>>
>>>              -s
>>>
>>>
>>
>
>        [[alternative HTML version deleted]]
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Rcpp: Clarifying the meaning of GPL?

2009-12-23 Thread Jeff Ryan
One critical aspect to this is the fact that RcppTemplate seems to
have been where the Rcpp work moved to _before_ abandoning the Rcpp
project.

http://cran.r-project.org/src/contrib/Archive/RcppTemplate/

So the 'namespace' of Rcpp was left with seemingly no public intention
of picking it up.

One of the strengths of GPL is that a package can live on when the
original author has chosen to go a different route.  Rcpp was
maintained by another person (with backward compatibility I think) to
likely not break his (and other's) code.

I don't think it is in the best interest of the community to break
existing code, just because one would like to have complete control
over the end product.

Plus, everyone benefits from competition.  And we have a good one here.

My 2c ;-)

Jeff





On Wed, Dec 23, 2009 at 3:21 PM, Henrik Bengtsson  
wrote:
> I guess one problem is who is in charge of the name Rcpp on CRAN.  For
> instance, can I "fork" of yet another version of Rcpp (or any other
> CRAN package) and submit it to CRAN?  Can the original author submit a
> completely different Rcpp package breaking all the additions made by
> the new contributors?  I don't think the GPL answers those questions,
> but maybe there is something on the ownership to the (original)
> "title/label/name/identifier" of a GPL artifact.
>
> My $.02
>
> /Henrik
>
> On Wed, Dec 23, 2009 at 1:00 PM, Stavros Macrakis  
> wrote:
>> The central purpose of the GPL license is precisely to allow and indeed
>> encourage the behavior your are criticizing.  In particular, when you
>> release software under the GPL, you are *explicitly* giving recipients of
>> the software the right to modify it pretty much in any way (trivial or
>> radical) they please and redistribute it by any means they choose (as long
>> as they redistribute source with binary and maintain the legal notices).
>> There is no legal or ethical obligation to consult the original author in
>> any way, or even to acknowledge the original author other than by
>> maintaining his or her copyright notice.  The only legal obligation is to
>> maintain the copyright notice and the GPL license itself and to include a
>> notice that the software has been modified (GPL3 section 5a).
>>
>> This is not an accident.  The promulgators of the GPL, the FSF, believe that
>> these are the conditions under which software is best distributed -- that
>> implementors should be free to combine bits and pieces of software from a
>> variety of GPL-compatible licenses with no fear of violating any of their
>> licenses.
>>
>> Obviously these legal and ethical conditions are quite different from those
>> which prevail in academic publishing, and if you don't like them, you should
>> be releasing your software under a different license -- which will probably
>> have the effect of making your software less useful to the community and
>> therefore less widely known and used.
>>
>>               -s
>>
>>
>> On Wed, Dec 23, 2009 at 11:05 AM, Dominick Samperi
>> wrote:
>>
>>> In my view what has happened is not much different from a situation where I
>>> place my
>>> name as co-author on a research paper that you have created, without your
>>> permission,
>>> after making a few small edits that you may not agree with. Furthermore, if
>>> you complain
>>> I simply present the results (at conferences) as my own without mentioning
>>> your name.
>>>
>>> Is this just a dispute between implementers?
>>>
>>> Stavros Macrakis wrote:
>>>
>>>  On Wed, Dec 23, 2009 at 12:27 AM, Dominick Samperi <
 djsamp...@earthlink.net > wrote:

    Stavros Macrakis wrote:

        That said, as a matter of courtesy and clarity, I'd think that
        a fork should use a different name.

    Yes, the point is that this is not a legal or technical matter, it
    is a matter of professional courtesy.

    I take this as one vote for the name change.


 The naming and maintenance history of this package (or these packages:
 Rcpp and RcppTemplate) appears to be complicated, and I have no interest in
 becoming an arbitrator or voter in what is a dispute between you and other
 implementers.

    On US copyright law, this should not be confused with "copyright"
    notices that appear in GPL
    source code. Remember that these are really "copyleft" notices,
    and copyleft is designed to
    protect the rights of copiers, not original contributors.


 The copyright notice is a correct and legally valid copyright notice.  The
 GPL (copyleft) is the copyright *license*.  Like all licenses, it defines
 the relationship between authors and copiers.  The GPL explicitly avoided
 the so-called "obnoxious BSD advertising clause", which has requirements
 about giving credit.

              -s


>>>
>>
>>        [[alternative HTML version deleted]]
>>
>> _

Re: [Rd] A package for visualizing R syntax

2009-12-23 Thread Gabor Grothendieck
Very nice.  Certainly it would be welcome to see this packaged for
widespread use.

On Wed, Dec 23, 2009 at 2:20 PM, Sylvain Loiseau
 wrote:
> Dear all,
>
> I have written a small set of functions for drawing graphical representations 
> of R objects and evaluations of R expressions.
>
> It is mainly intended for pedagogical purposes. Here are some samples:
>
> http://panini.u-paris10.fr/~sloiseau/sampleGraphics.pdf
>
> The idea is to use some graphical conventions in order to make clear the 
> abstract syntax and to explain function, extraction, recycling, type 
> conversion, properties of data structures, etc.
>
> I would be very interested in your reactions and comments. I'm wondering if 
> it may become a R package. Does something like this already exist? May it be 
> useful? What improvement may be planned? Have you some idea for the name of 
> such a package (visualR, seeR... ?)
>
> Best regards,
> Sylvain
> --
> Sylvain Loiseau
> sylvain.lois...@unicaen.fr
>
> Université de Caen Basse Normandie
> Maison de la Recherche en Sciences Humaines
> MRSH - SH018
> Esplanade de la Paix
> Campus 1
> 14032 Caen Cedex
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] A package for visualizing R syntax

2009-12-23 Thread Felix Andrews
Nice idea.
But I think "visualR" or "seeR" are way too vague.
How about "drawExpressions", or "showExpressions"?

-Felix

2009/12/24 Sylvain Loiseau :
> Dear all,
>
> I have written a small set of functions for drawing graphical representations 
> of R objects and evaluations of R expressions.
>
> It is mainly intended for pedagogical purposes. Here are some samples:
>
> http://panini.u-paris10.fr/~sloiseau/sampleGraphics.pdf
>
> The idea is to use some graphical conventions in order to make clear the 
> abstract syntax and to explain function, extraction, recycling, type 
> conversion, properties of data structures, etc.
>
> I would be very interested in your reactions and comments. I'm wondering if 
> it may become a R package. Does something like this already exist? May it be 
> useful? What improvement may be planned? Have you some idea for the name of 
> such a package (visualR, seeR... ?)
>
> Best regards,
> Sylvain
> --
> Sylvain Loiseau
> sylvain.lois...@unicaen.fr
>
> Université de Caen Basse Normandie
> Maison de la Recherche en Sciences Humaines
> MRSH - SH018
> Esplanade de la Paix
> Campus 1
> 14032 Caen Cedex
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



-- 
Felix Andrews / 安福立
Postdoctoral Fellow
Integrated Catchment Assessment and Management (iCAM) Centre
Fenner School of Environment and Society [Bldg 48a]
The Australian National University
Canberra ACT 0200 Australia
M: +61 410 400 963
T: + 61 2 6125 4670
E: felix.andr...@anu.edu.au
CRICOS Provider No. 00120C
-- 
http://www.neurofractal.org/felix/

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] A package for visualizing R syntax

2009-12-23 Thread Gabor Grothendieck
or ExpressionBlocks

On Wed, Dec 23, 2009 at 5:12 PM, Felix Andrews  wrote:
> Nice idea.
> But I think "visualR" or "seeR" are way too vague.
> How about "drawExpressions", or "showExpressions"?
>
> -Felix
>
> 2009/12/24 Sylvain Loiseau :
>> Dear all,
>>
>> I have written a small set of functions for drawing graphical 
>> representations of R objects and evaluations of R expressions.
>>
>> It is mainly intended for pedagogical purposes. Here are some samples:
>>
>> http://panini.u-paris10.fr/~sloiseau/sampleGraphics.pdf
>>
>> The idea is to use some graphical conventions in order to make clear the 
>> abstract syntax and to explain function, extraction, recycling, type 
>> conversion, properties of data structures, etc.
>>
>> I would be very interested in your reactions and comments. I'm wondering if 
>> it may become a R package. Does something like this already exist? May it be 
>> useful? What improvement may be planned? Have you some idea for the name of 
>> such a package (visualR, seeR... ?)
>>
>> Best regards,
>> Sylvain
>> --
>> Sylvain Loiseau
>> sylvain.lois...@unicaen.fr
>>
>> Université de Caen Basse Normandie
>> Maison de la Recherche en Sciences Humaines
>> MRSH - SH018
>> Esplanade de la Paix
>> Campus 1
>> 14032 Caen Cedex
>>
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>
>
>
> --
> Felix Andrews / 安福立
> Postdoctoral Fellow
> Integrated Catchment Assessment and Management (iCAM) Centre
> Fenner School of Environment and Society [Bldg 48a]
> The Australian National University
> Canberra ACT 0200 Australia
> M: +61 410 400 963
> T: + 61 2 6125 4670
> E: felix.andr...@anu.edu.au
> CRICOS Provider No. 00120C
> --
> http://www.neurofractal.org/felix/
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] choose(n,k) when n is almost integer

2009-12-23 Thread Petr Savicky
In a previous email, i suggested two patches A and B to choose(n, k), which
solve some of its problems, but keep some of the inaccuracies of the original
implementation. I would like to suggest another patch, which i will call C
(patch-C.txt in an attachment), which eliminates the warnings obtained sometimes
from the original implementation and which is more accurate in all ranges of
the output.

For testing patch C a simpler script is sufficient, since we need not to take
care of the warnings. Namely
  http://www.cs.cas.cz/~savicky/R-devel/test_choose_1.R
which produces the output (the error is the relative error)

  > source("test_choose_1.R")
  k <= 0 max err = 0 
  k <= 10 max err = 1.332268e-15 
  k <= 20 max err = 2.442491e-15 
  k <= 30 max err = 3.774758e-15 
  k <= 40 max err = 2.553513e-14 
  k <= 50 max err = 2.88658e-14 
  k <= 60 max err = 3.197442e-14 
  k <= 70 max err = 4.396483e-14 
  k <= 80 max err = 4.685141e-14 
  k <= 90 max err = 4.907186e-14 
  k <= 100 max err = 5.084821e-14 
  k <= 110 max err = 5.373479e-14 
  k <= 120 max err = 5.551115e-14 
  k <= 130 max err = 7.41629e-14 
  k <= 140 max err = 9.592327e-14 
  k <= 150 max err = 9.636736e-14 
  k <= 160 max err = 9.725554e-14 
  k <= 170 max err = 9.947598e-14 
  k <= 180 max err = 1.04583e-13 
  k <= 190 max err = 1.088019e-13 
  k <= 200 max err = 1.090239e-13 
  minimum log2() of a wrong result for integer n : 53.32468 
  maximum error for real n : 1.090239e-13 

Increasing accuracy of choose(n, k) for n almost an integer needed to use
additional transformations of it to those already used in the code. I will
work out a description of these transformations and send a link to it.
Similarly as patches A and B, patch C also does not modify lchoose().

It should be pointed out that choose(n, k) for non-integer n is mainly
needed if n is a rational number like 1/2, 1/3, 2/3,  However, making
choose(n, k) accurate for all inputs seems to be not too complex as the
patch C and its test results show.

I appreciate comments on patch C.

Petr Savicky.

--- R-devel-orig-intel/src/nmath/choose.c   2009-12-17 17:52:39.0 
+0100
+++ R-devel-work-copy-3-intel/src/nmath/choose.c2009-12-23 
21:59:40.0 +0100
@@ -93,13 +93,14 @@
 return lfastchoose(n, k);
 }
 
+#define IS_INT(x)((x) == floor(x))
 #define k_small_max 30
 /* 30 is somewhat arbitrary: it is on the *safe* side:
  * both speed and precision are clearly improved for k < 30.
 */
 double choose(double n, double k)
 {
-double r, k0 = k;
+double r, k0 = k, l, aux;
 k = floor(k + 0.5);
 #ifdef IEEE_754
 /* NaNs propagated correctly */
@@ -109,36 +110,37 @@
MATHLIB_WARNING2(_("'k' (%.2f) must be integer, rounded to %.0f"), k0, 
k);
 if (k < k_small_max) {
int j;
-   if(n-k < k && n >= 0 && R_IS_INT(n)) k = n-k; /* <- Symmetry */
+   if(n-k < k && n >= 0 && IS_INT(n)) k = n-k; /* <- Symmetry */
if (k <  0) return 0.;
if (k == 0) return 1.;
/* else: k >= 1 */
r = n;
for(j = 2; j <= k; j++)
-   r *= (n-j+1)/j;
-   return R_IS_INT(n) ? floor(r + 0.5) : r;
+   r *= (n-(j-1))/j;
+   return IS_INT(n) ? floor(r + 0.5) : r;
/* might have got rounding errors */
 }
 /* else: k >= k_small_max */
 if (n < 0) {
-   r = choose(-n+ k-1, k);
-   if (ODD(k)) r = -r;
+   r = n / k * choose(k - 1.0 - n, k - 1.0);
+   if (ODD(k - 1.0)) r = -r;
return r;
 }
-else if (R_IS_INT(n)) {
+else if (IS_INT(n)) {
if(n < k) return 0.;
if(n - k < k_small_max) return choose(n, n-k); /* <- Symmetry */
return floor(exp(lfastchoose(n, k)) + 0.5);
 }
 /* else non-integer n >= 0 : */
-if (n < k-1) {
-   int s_choose;
-   r = lfastchoose2(n, k, /* -> */ &s_choose);
-   return s_choose * exp(r);
+l = floor(n + 0.5);
+if (l <= k-1) {
+   aux = lfastchoose(n, l) + lfastchoose(k - 1.0 - n, k - l - 1.0) - 
lfastchoose(k, l);
+   return exp(aux) * (n - l) / (k - l) * (ODD(k - l) ? 1.0 : - 1.0);
 }
 return exp(lfastchoose(n, k));
 }
 
 #undef ODD
+#undef IS_INT
 #undef R_IS_INT
 #undef k_small_max
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Locating code that is outside of functions in R scripts

2009-12-23 Thread gheine

Working with a number of scripts (text files with R commands) that I

"source" into R sessions from time to time.

The source() command is most convenient (at least for me) 

if it only loads function definitions, and doesn't otherwise change the

interactive environment.  For example, I might have a file that looks like



func1<-function() {

  code

  code

  code

  }

# this is a comment



A<-"this is code outside the function definitions";



func2<-function() {

   code

# a comment with a spurious } 

   code

   code

   }



I would like a quick-and-dirty script that finds the line beginnning with

"A", since it is R code outside of any function definition.

On the other hand it would ignore the two comment lines, and would not be

fooled by the spurious "}" in the second comment line.

Probably not too hard to put something like this together, but am making

this post in case it is something that has already been done.





Thanks!

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Locating code that is outside of functions in R scripts

2009-12-23 Thread Duncan Murdoch

On 23/12/2009 7:04 PM, ghe...@mathnmaps.com wrote:

Working with a number of scripts (text files with R commands) that I

"source" into R sessions from time to time.

The source() command is most convenient (at least for me) 


if it only loads function definitions, and doesn't otherwise change the

interactive environment.  For example, I might have a file that looks like



func1<-function() {

  code

  code

  code

  }

# this is a comment



A<-"this is code outside the function definitions";



func2<-function() {

   code

# a comment with a spurious } 


   code

   code

   }



I would like a quick-and-dirty script that finds the line beginnning with

"A", since it is R code outside of any function definition.

On the other hand it would ignore the two comment lines, and would not be

fooled by the spurious "}" in the second comment line.

Probably not too hard to put something like this together, but am making

this post in case it is something that has already been done.


You should call parse() to process the file, then examine the list of 
expressions that gets returned.  This function will recognize a function 
definition if it is the form above:


isfundef <- function(e) {
  identical(e[[1]], quote(`<-`)) && identical(e[[3]][[1]], 
quote(`function`))

}

but there are other ways to create functions which it will miss. 
Nevertheless, pasting your code into a file and doing this seems to give 
you what you want:


> exprs <- parse("test.R")
> lapply(exprs, isfundef)
[[1]]
[1] TRUE

[[2]]
[1] FALSE

[[3]]
[1] TRUE

> exprs[[2]]
A <- "this is code outside the function definitions"

or

> exprs[!unlist(lapply(exprs, isfundef))]
expression(A<-"this is code outside the function definitions")


Duncan Murdoch

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Locating code that is outside of functions in R scripts

2009-12-23 Thread Gabor Grothendieck
This sources the indicated file into the local environment (i.e. the
environment within src) and then only copies out the objects that are
functions into the workspace so that you are only left with them.

src <- function(file) {
   source(file, local = TRUE)
   for(nm in ls(all = TRUE)) if (is.function(get(nm))) assign(nm,
get(nm), .GlobalEnv)
}

# usage:
src("myfile.R")

On Wed, Dec 23, 2009 at 7:04 PM,   wrote:
>
> Working with a number of scripts (text files with R commands) that I
>
> "source" into R sessions from time to time.
>
> The source() command is most convenient (at least for me)
>
> if it only loads function definitions, and doesn't otherwise change the
>
> interactive environment.  For example, I might have a file that looks like
>
>
>
> func1<-function() {
>
>  code
>
>  code
>
>  code
>
>  }
>
> # this is a comment
>
>
>
> A<-"this is code outside the function definitions";
>
>
>
> func2<-function() {
>
>   code
>
> # a comment with a spurious }
>
>   code
>
>   code
>
>   }
>
>
>
> I would like a quick-and-dirty script that finds the line beginnning with
>
> "A", since it is R code outside of any function definition.
>
> On the other hand it would ignore the two comment lines, and would not be
>
> fooled by the spurious "}" in the second comment line.
>
> Probably not too hard to put something like this together, but am making
>
> this post in case it is something that has already been done.
>
>
>
>
>
> Thanks!
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Rcpp: Clarifying the meaning of GPL?

2009-12-23 Thread Dominick Samperi


Jeff Ryan wrote:

One critical aspect to this is the fact that RcppTemplate seems to
have been where the Rcpp work moved to _before_ abandoning the Rcpp
project.
  

The Rcpp package was not abandoned, it was renamed to RcppTemplate
because I thought it would be more useful for the R community to have a
complete solution to the package development problem,
not just a stand-alone library (Rcpp). The Rcpp package (not to be confused
with the Rcpp library!) forked from RcppTemplate_5.3, not Rcpp_x_x,
and RcppTemplate was in the CRAN archives the whole time (not
abandoned).

This explains Stavros' confusion about the naming, and it also highlights
the questions raised by Henrik. Perhaps there is a need for a package
name registrar.


Plus, everyone benefits from competition.  And we have a good one here.

  

I do not think having to compete with your own work is a "good one."
I may have to rename RcppTemplate and the Rcpp library again to
something entirely different.

Dominick

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel