[Rd] R for Windows FAQ 2.8 suggestion

2008-02-24 Thread Roger Bivand
The current text for: 2.8 What's the best way to upgrade? says:

"That's a matter of taste. For most people the best thing to do is to 
uninstall R (see the previous Q), install the new version, copy any 
installed packages to the library folder in the new installation, run 
update.packages() in the new R (`Update packages...' from the Packages 
menu, if you prefer) and then delete anything left of the old 
installation. Different versions of R are quite deliberately installed in 
parallel folders so you can keep old versions around if you wish."

The second paragraph can probably be dropped.

Following the 2.5/2.6 changes in primitive functions, as publicised in:

https://stat.ethz.ch/pipermail/r-help/2007-October/142367.html

I have found that users are confused, and that the advice to "copy any 
installed packages to the library folder in the new installation" is now 
unhelpful. The FAQ does mention (in various places) the benefits of having 
an installation library and one or more user libraries, but 2.8 seems to 
miss this. Could I suggest modifying it to something like:

"That's a matter of taste. If you do not have your own library where you 
have installed packages, you may want to record which there are before 
uninstalling the old version of R. This will return a character vector of 
package names:

z <- installed.packages(priority = "NA")[, "Package"]

which can be exported using save() to a safe place. Next uninstall the 
old version of R, install the new version, load your list of packages, and 
pass it to install.packages().

This can be tedious, involving more work than the alternative of having 
your own library for installing contributed packages - see references to 
setting the R_LIBS environment variable elsewhere in this document (e.g. 
4.2), and/or the help page for the .libPaths() function for help on 
creating and using such a library. If you have your own library, upgrading 
R is much simpler: uninstall the old version of R, install the new 
version, and run:

update.packages(checkBuilt=TRUE, ask=FALSE)

which will see whether packages in your own library need updating for the 
R build you have installed."

The text could be made more aggressive, by swapping the order and 
indicating that, in a Vista-esque world, installing in the release library 
directory is asking for trouble and deprecated. But I'm not sure about 
that.

Of course, I'm being very optimistic, hoping that users will read the FAQ, 
but at least they can be pointed to it when they get into trouble.

Roger

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [EMAIL PROTECTED]

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


Re: [Rd] .net and R

2008-02-24 Thread Michael Lawrence
On Sat, Feb 23, 2008 at 3:18 AM, Yuan Jian <[EMAIL PROTECTED]> wrote:

> Hi,
>  is it possible to call R functions from visual studio .net such as c#?
>
>
There is at least one existing C# program accessing R:

http://ncrr.pnl.gov/software/dante.stm

They do it using the R(D)COM server, which is unfortunately not portable but
maybe it will give you a head start.

Michael


>
>
> -
>
>[[alternative HTML version deleted]]
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

[[alternative HTML version deleted]]

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


[Rd] Standard method for S4 object

2008-02-24 Thread Christophe Genolini
Hi the list,

I am defining a new class. Shortly, I will submit a package with it. 
Before, I would like to know if there is a kind of "non official list" 
of what method a new S4 object should have.
More precisely, personally, I use 'print', 'summary' and 'plot' a lot. 
So for my new class, I define these 3 methods and of course, a get and a 
set for each slot. What else? Is there some other methods that a R user 
can reasonably expect? Some "minimum basic tools"...

Thanks

Christophe


[[alternative HTML version deleted]]

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


Re: [Rd] Standard method for S4 object

2008-02-24 Thread Katharine Mullen
I don't know of any  '"non official list" of what method a new S4 object
should have' - such a list would have to depend on what the object
represents.  If it represents the output of fitting a model, then methods
for 'residuals', 'fitted' and 'coefficients' would probably be nice.

Also, out of curiosity, what do your methods for `get' and `set' for each
slot look like?  Is there any advantage to using such methods over using

slot(objectOfYourClass, "aSlotName") # for get, and
slot(objectOfYourClass, "aSlotName") <- aValue # for set

On Sat, 23 Feb 2008, Christophe Genolini wrote:

> Hi the list,
>
> I am defining a new class. Shortly, I will submit a package with it.
> Before, I would like to know if there is a kind of "non official list"
> of what method a new S4 object should have.
> More precisely, personally, I use 'print', 'summary' and 'plot' a lot.
> So for my new class, I define these 3 methods and of course, a get and a
> set for each slot. What else? Is there some other methods that a R user
> can reasonably expect? Some "minimum basic tools"...
>
> Thanks
>
> Christophe
>
>
>   [[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


[Rd] 'Esc' crashes R in MacOX 10.5.2 (PR#10839)

2008-02-24 Thread abond
Full_Name: Alex Bond
Version: 2.6.2
OS: MacOSX 10.5.2
Submission from: (NULL) (142.163.207.86)


Pressing 'esc' while typing any (e.g., aov, lm, etc.) command line causes the
program to become non-responsive resulting in "Force Quit" to use the program
again.

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


Re: [Rd] Standard method for S4 object

2008-02-24 Thread Christophe Genolini
For what I understand so far :

For set, you can add some verification of object internal coherance. The 
initialize make verification when you create your object,
aSlotName<- can make some verification when you change your slot.

For get, you can build some more elabored method than just getting a  
slot. For example
getSlotA can get the value of a slot wich is a list for some convenience 
and return a matrix.
Or it can get matrix A using some columne name define in slot B.
Or it can get the first colonm of A only...

Christophe


> I don't know of any  '"non official list" of what method a new S4 object
> should have' - such a list would have to depend on what the object
> represents.  If it represents the output of fitting a model, then methods
> for 'residuals', 'fitted' and 'coefficients' would probably be nice.
>
> Also, out of curiosity, what do your methods for `get' and `set' for each
> slot look like?  Is there any advantage to using such methods over using
>
> slot(objectOfYourClass, "aSlotName") # for get, and
> slot(objectOfYourClass, "aSlotName") <- aValue # for set
>
> On Sat, 23 Feb 2008, Christophe Genolini wrote:
>
>   
>> Hi the list,
>>
>> I am defining a new class. Shortly, I will submit a package with it.
>> Before, I would like to know if there is a kind of "non official list"
>> of what method a new S4 object should have.
>> More precisely, personally, I use 'print', 'summary' and 'plot' a lot.
>> So for my new class, I define these 3 methods and of course, a get and a
>> set for each slot. What else? Is there some other methods that a R user
>> can reasonably expect? Some "minimum basic tools"...
>>
>> Thanks
>>
>> Christophe
>>
>>
>>  [[alternative HTML version deleted]]
>>
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>> 
>
>   


[[alternative HTML version deleted]]

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


Re: [Rd] 'Esc' crashes R in MacOX 10.5.2 (PR#10839)

2008-02-24 Thread Uwe Ligges


[EMAIL PROTECTED] wrote:
> Full_Name: Alex Bond
> Version: 2.6.2
> OS: MacOSX 10.5.2
> Submission from: (NULL) (142.163.207.86)
> 
> 
> Pressing 'esc' while typing any (e.g., aov, lm, etc.) command line causes the
> program to become non-responsive resulting in "Force Quit" to use the program
> again.

... and this is the xxx-th bug report about it!
Please check the archives on solutions.

Uwe Ligges

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


Re: [Rd] Clipping using par(plt=..., xpd=FALSE) inconsistencies

2008-02-24 Thread Paul Murrell
Hi


Prof Brian Ripley wrote:
> I think you misunderstand what par("plt") is supposed to do.  The 
> documentation says
> 
>   'plt' A vector of the form 'c(x1, x2, y1, y2)' giving the
>coordinates of the plot region as fractions of the current
>figure region.
> 
> You haven't subsequently made a new plot, so why do you expect the 
> clipping region to be changed to that you indicated for the next plot?
> 
> I'd say the bug was that box() changed it, and that happens because it 
> internally sets xpd and so resetting xpd sets the clipping region next 
> time it is used.  Because of
> 
> void GClip(pGEDevDesc dd)
> {
>  if (gpptr(dd)->xpd != gpptr(dd)->oldxpd) {
>   double x1, y1, x2, y2;
>   setClipRect(&x1, &y1, &x2, &y2, DEVICE, dd);
>   GESetClip(x1, y1, x2, y2, dd);
>   gpptr(dd)->oldxpd = gpptr(dd)->xpd;
>  }
> }
> 
> Maybe we should have user-level code to set the clipping region?


I think that would be reasonable.  I added grid.clip() to grid for
situations like this.

Paul


> On Fri, 22 Feb 2008, Greg Snow wrote:
> 
>> Here is a demonstration of behaviour that is probably an optimization by
>> someone far smarter than me that did not anticipate anyone wanting to do
>> this, but for my purposes it looks more like a bug than a feature.
>>
>> I have tested this with R2.6.2 on Windows, no additional packages loaded
>> (beyond the default), I have tested using the default graphics object,
>> pdf, jpeg, and cairoDevice (ok I loaded a package for that) and all show
>> the same behavior.
>>
>> Run the following set of commands:
>>
>> x <- rnorm(1000)
>> hist(x, xlim=c(-4,4))
>>
>> tmp <- par('plt')
>>
>> box(col='#')
>> tmp2 <- tmp
>> tmp2[2] <- tmp2[1] + 0.3
>> par(xpd = FALSE, plt=tmp2)
>> hist(x, col='red', add=TRUE)
>>
>> box(col='#')
>> tmp3 <- tmp
>> tmp3[1] <- tmp3[2] - 0.3
>> par(xpd=FALSE, plt=tmp3)
>> hist(x, col='blue', add=TRUE)
>> par(plt=tmp)
>>
>>
>> This gives me the plot that I want and expect (a histogram with the left
>> section red, the middle white/background, and the right blue).
>>
>> Now comment out or delete the 2 box commands and rerun everything.  The
>> clipping does not happen this time and the final result is a full blue
>> histogram.
>>
>> Is this a bug? Feature? Something else?
>> Does anyone have a better work around than drawing transparent boxes?
>>
>> Thanks,
>>
>>
>>
>>
> 

-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
[EMAIL PROTECTED]
http://www.stat.auckland.ac.nz/~paul/

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


Re: [Rd] 'Esc' crashes R in MacOX 10.5.2 (PR#10839)

2008-02-24 Thread Simon Urbanek

On Feb 24, 2008, at 1:58 PM, Uwe Ligges wrote:

>
>
> [EMAIL PROTECTED] wrote:
>> Full_Name: Alex Bond
>> Version: 2.6.2
>> OS: MacOSX 10.5.2
>> Submission from: (NULL) (142.163.207.86)
>>
>>
>> Pressing 'esc' while typing any (e.g., aov, lm, etc.) command line  
>> causes the
>> program to become non-responsive resulting in "Force Quit" to use  
>> the program
>> again.
>
> ... and this is the xxx-th bug report about it!
> Please check the archives on solutions.
>

... and use the latest version - the fix is on CRAN for a while now ...

Simon

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


Re: [Rd] Aliasing a function

2008-02-24 Thread Tony Plate
Maybe something like this? (though it seems like it might be more 
straightforward to do this sort of thing by text-processing a source 
file then source'ing it in R).

 > f <- function(a, b, c) c(a=a,b=b,c=c)
 > attr(f, "source") <- NULL
 > f
function (a, b, c)
c(a = a, b = b, c = c)
 > g1 <- f
 > ff <- formals(f)
 > argtrans <- c(a="d", b="e", c="f")
 > names(ff) <- argtrans
 > g2 <- as.function(c(ff, as.call(c(list(as.name("f")), 
lapply(argtrans, as.name)
 > g2
function (d, e, f)
f(a = d, b = e, c = f)
 > f(1,2,3)
a b c
1 2 3
 > g1(a=1,b=2,c=3)
a b c
1 2 3
 > g2(d=1,e=2,f=3)
a b c
1 2 3
 >

-- Tony Plate


hadley wickham wrote:
> On Sat, Feb 23, 2008 at 5:52 PM, Gabor Grothendieck
> <[EMAIL PROTECTED]> wrote:
>   
>> I assume he wants to be able to change the
>>  formals although its confusing since the example
>>  uses the same formals in both cases.
>> 
>
> Yes, that was an important point that I forgot to mention!  Thanks for
> the pointer to formals but it doesn't work in this case:
>
> function (a = 1, b = 2, c = 3)
> g(...)
>   
>> f(c=5)
>> 
> Error in f(c = 5) : '...' used in an incorrect context
>
> Hadley
>
>
>

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