[Rd] A doubt about substitute() after delayedAssign()

2012-04-29 Thread Philippe Grosjean

Hello,

?delayedAssign presents substitute() as a way to look at the expression 
in the promise. However,


msg <- "old"
delayedAssign("x", msg)
msg <- "new!"
x #- new!
substitute(x) #- x (was 'msg' ?)

Here, we just got 'x'... shouldn't we got 'msg'?

Same result when the promise is not evaluated yet:

delayedAssign("x", msg)
substitute(x)

In a function, that works:

foo <- function (x = msg) substitute(x)
foo()

Did I misunderstood something? It seems to me that substitute() does not 
behaves as documented for promises created using delayedAssign().

Best,

Philippe
--
..<ยก}))><
 ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
 ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
 ) ) ) ) )   Mons University, Belgium
( ( ( ( (
..

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


Re: [Rd] A doubt about substitute() after delayedAssign()

2012-04-29 Thread Duncan Murdoch

On 12-04-29 3:30 AM, Philippe Grosjean wrote:
> Hello,
>
> ?delayedAssign presents substitute() as a way to look at the expression
> in the promise. However,
>
> msg<- "old"
> delayedAssign("x", msg)
> msg<- "new!"
> x #- new!
> substitute(x) #- x (was 'msg' ?)
>
> Here, we just got 'x'... shouldn't we got 'msg'?
>
> Same result when the promise is not evaluated yet:
>
> delayedAssign("x", msg)
> substitute(x)
>
> In a function, that works:
>
> foo<- function (x = msg) substitute(x)
> foo()
>
> Did I misunderstood something? It seems to me that substitute() does not
> behaves as documented for promises created using delayedAssign().

I don't think this is well documented, but substitute() doesn't act the 
same when its "env" argument is the global environment.  So this works 
the way you'd expect:


e <- new.env()
msg <- "old"
delayedAssign("x", msg, assign=e)
msg <- "new"
e$x
substitute(x, e)

I forget what the motivation was for special-casing globalenv().

Duncan Murdoch

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


[Rd] creating a package in R

2012-04-29 Thread nossa
Please  give me the necessary links that permits me to create my own package
inR

--
View this message in context: 
http://r.789695.n4.nabble.com/creating-a-package-in-R-tp4596411p4596411.html
Sent from the R devel mailing list archive at Nabble.com.

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


Re: [Rd] creating a package in R

2012-04-29 Thread R. Michael Weylandt
http://cran.r-project.org/doc/manuals/R-exts.pdf

Ships with every distribution of R

Michael

On Apr 29, 2012, at 10:08 AM, nossa  wrote:

> Please  give me the necessary links that permits me to create my own package
> inR
> 
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/creating-a-package-in-R-tp4596411p4596411.html
> Sent from the R devel mailing list archive at Nabble.com.
> 
> __
> 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] creating a package in R

2012-04-29 Thread Joris Meys
http://lmgtfy.com/?q=writing+an+R+package

There you go.



On Sun, Apr 29, 2012 at 4:28 PM, R. Michael Weylandt <
michael.weyla...@gmail.com>  wrote:

> http://cran.r-project.org/doc/manuals/R-exts.pdf
>
> Ships with every distribution of R
>
> Michael
>
> On Apr 29, 2012, at 10:08 AM, nossa  wrote:
>
> > Please  give me the necessary links that permits me to create my own
> package
> > inR
> >
> > --
> > View this message in context:
> http://r.789695.n4.nabble.com/creating-a-package-in-R-tp4596411p4596411.html
> > Sent from the R devel mailing list archive at Nabble.com.
> >
> > __
> > 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
>



-- 
Joris Meys
Statistical consultant

Ghent University
Faculty of Bioscience Engineering
Department of Mathematical Modelling, Statistics and Bio-Informatics

tel : +32 9 264 59 87
joris.m...@ugent.be
---
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

[[alternative HTML version deleted]]

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


Re: [Rd] creating a package in R

2012-04-29 Thread steven mosher
If you want simple step by step instructions for Windows, try this

http://stevemosher.wordpress.com/ten-steps-to-building-an-r-package-under-windows/


On Sun, Apr 29, 2012 at 7:08 AM, nossa  wrote:

> Please  give me the necessary links that permits me to create my own
> package
> inR
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/creating-a-package-in-R-tp4596411p4596411.html
> Sent from the R devel mailing list archive at Nabble.com.
>
> __
> 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