[Rd] prompt () and backticks for default arguments

2010-08-17 Thread Claudia Beleites

Dear all,

I just noticed, that prompt () looses backticks that protect default arguments:

f <- function (FUN = `*`) {}

cat (prompt (f, NA)$usage)

yields:
\usage{ f(FUN = *) } %- maybe also 'usage' for other objects documented here.
without the backticks, which is of course found by R CMD check as syntax error.

While this is easily fixed if the .Rd is further edited manually, I stumbled 
over it using the automated .Rd generation with inlinedocs - in this combination 
it is very inconvenient.


Any suggestions?

All the best,

Claudia


--
Claudia Beleites
Dipartimento dei Materiali e delle Risorse Naturali
Università degli Studi di Trieste
Via Alfonso Valerio 6/a
I-34127 Trieste

phone: +39 0 40 5 58-37 68
email: cbelei...@units.it

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


Re: [Rd] parent.frame(1) of a S4 method is not a calling environment.

2010-08-17 Thread Duncan Murdoch

Vitaly S. wrote:

Martin Morgan  writes:
  

So,  can I be sure that for such functions parent.frame(2) will always work?
What are the additional rules?
  

callNextMethod() will cause additional problems; the idea that you'll
grab things from somewhere other than function arguments doesn't seem
like a robust design, even if it's used in some important parts of R.

Martin




That make it difficult to handle unevaluated expressions in methods. A solution
would be to explicitly require the users to use quote() or expression(),  and
then to use the "expression" in the signature. Slightly unpleasant, though.

  


You could use formulas for that.  If you pass in

formula = ~ x + y*z

then environment(formula) will be the right evaluation environment, and 
formula[[2]] will be the unevaluated x + y*z.


Duncan Murdoch


Standardised, simpler syntax like .() in  ggplot and plyr,  would be handy here.
Hopefully .() is not grabbed for something else in meanwhile:).

Vitaly.

__
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] prompt () and backticks for default arguments

2010-08-17 Thread Prof Brian Ripley

On Tue, 17 Aug 2010, Claudia Beleites wrote:


Dear all,

I just noticed, that prompt () looses backticks that protect default 
arguments:


f <- function (FUN = `*`) {}

cat (prompt (f, NA)$usage)

yields:
\usage{ f(FUN = *) } %- maybe also 'usage' for other objects documented here.
without the backticks, which is of course found by R CMD check as syntax 
error.


While this is easily fixed if the .Rd is further edited manually, I stumbled 
over it using the automated .Rd generation with inlinedocs - in this 
combination it is very inconvenient.


Any suggestions?


Add backtick = TRUE to the deparse() call in prompt.default().



All the best,

Claudia


--
Claudia Beleites
Dipartimento dei Materiali e delle Risorse Naturali
Università degli Studi di Trieste
Via Alfonso Valerio 6/a
I-34127 Trieste

phone: +39 0 40 5 58-37 68
email: cbelei...@units.it

__
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] DetachedEval Issues

2010-08-17 Thread Martin Kerr

Hello everyone,
I have been attempting to make use of the newly implemented detachedEval 
functionality and I am having a few teething issues.
My code works fine when tested with both the Client and the Server on a single 
machine, but issues arise when I run them separately.Possibly because the local 
/ local connection is running voer a Unix socket rather than tcp proper?
Rsession* theSession;theSession = 
rc->detachedEval("source(\"hdlc_processing.r\")");delete rc;
rc = new Rconnection(theSession);rc->connect();

Owing to firewall issues I am having to make use of an ssh tunnel for the 
connection, hence the manual override of the port number.Thus I am in fact 
using this:
Rsession* testSession = new 
Rsession(theSession->host(),6311,theSession->key());rc = new 
Rconnection(testSession);rc->connect();
This results in the following being outputted on the Rserve debug side.
session: resuming session, waiting for connections.connection accepted.sending 
ID string.
header read result: 16DUMP [16]: 31 be 18 07 15 57 93 6f 9d a3 53 56 99 f4 3b 
7fdiscarding buffer because too big (awaiting 1871927061 bytes)
Any help would be greatly appreciated.
Thank You
Martin Kerr
  
[[alternative HTML version deleted]]

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


Re: [Rd] prompt () and backticks for default arguments

2010-08-17 Thread Claudia Beleites

Thanks, that works.

Are there any drawbacks to doing that in general?

If not, I suggest the following patch for utils/prompt.R

87c87,88
<   paste(deparse(argls[[i]], width.cutoff= 500L),
---
>   paste(deparse(argls[[i]], width.cutoff= 500L,
> backtick = TRUE),

(Did I get right that this is waht I'm supposed to do?)

Best regards & thanks again,

Claudia


Prof Brian Ripley wrote:

On Tue, 17 Aug 2010, Claudia Beleites wrote:


Dear all,

I just noticed, that prompt () looses backticks that protect default 
arguments:


f <- function (FUN = `*`) {}

cat (prompt (f, NA)$usage)

yields:
\usage{ f(FUN = *) } %- maybe also 'usage' for other objects 
documented here.
without the backticks, which is of course found by R CMD check as 
syntax error.


While this is easily fixed if the .Rd is further edited manually, I 
stumbled over it using the automated .Rd generation with inlinedocs - 
in this combination it is very inconvenient.


Any suggestions?


Add backtick = TRUE to the deparse() call in prompt.default().



All the best,

Claudia


--
Claudia Beleites
Dipartimento dei Materiali e delle Risorse Naturali
Università degli Studi di Trieste
Via Alfonso Valerio 6/a
I-34127 Trieste

phone: +39 0 40 5 58-37 68
email: cbelei...@units.it

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






--
Claudia Beleites
Dipartimento dei Materiali e delle Risorse Naturali
Università degli Studi di Trieste
Via Alfonso Valerio 6/a
I-34127 Trieste

phone: +39 0 40 5 58-37 68
email: cbelei...@units.it

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


[Rd] Problems building own package (Error: "package has been build before R-2.10.0")

2010-08-17 Thread Janko Thyson
Dear List,

 

I’m doing my first baby steps towards developing own R Packages and ran into
the following problem:

 

R CMD check mypackage works fine (no errors, no warnings)

R CMD build mypackage works fine (no errors, no warnings)

R CMD INSTALL –library=”C:\R\R-2.11.1\library”
“something\mypackage\mypackage_1.0.tar.gz” works fine (no errors, no
warnings)

 

However, when I try loading the package in an R-Session (version 2.11.1) via
“library(mypackage)”, R complains about the package being build before
version R-2.10.0 and tells me to rebuild it.

 

Could this possibly be due to the fact that I have multiple R versions
installed (this also includes the most recent one, though)? 

 

To provide you with some details:

-  Running Windows XP

-  All of my R versions are under “C:\R” (versions 2.9.2, 2.10.1,
2.11.1).

-  I installed Rtools (version 2.1.2) to “C:\Rtools” and pointed it
to “C:\R” (as this was the default) to interact with R (should this maybe
have been “C:\R\R-2.11.1”?). I also installed everything else necessary to
build packages (Inno Setup etc.).

-  My PATH is set up as explained in R-Admin manual. Also, the only
R version stated there is “C:\R\R-2.11.1\bin;”.

-  I updated the DESCRIPTION file and specified all .Rd files
correctly.

 

Any idea what I’m doing wrong?

 

Thanks a ton,

Janko

 

  _  

 

Janko Thyson
  janko.thy...@ku-eichstaett.de

Catholic University of Eichstätt-Ingolstadt
Ingolstadt School of Management
Statistics and Quantitative Methods
Auf der Schanz 49
D-85049 Ingolstadt

  www.wfi.edu/lsqm

Fon:  +49 841 937-1923
Fax:  +49 841 937-1965

This e-mail and any attachment is for authorized use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be
copied, disclosed to, retained or used by any other party.
If you are not an intended recipient then please promptly delete this
e-mail and any attachment and all copies and inform the sender.

 

  _  

 


[[alternative HTML version deleted]]

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


Re: [Rd] [R] Problems building own package (Error: "package has been build before R-2.10.0")

2010-08-17 Thread Uwe Ligges



On 17.08.2010 20:36, Janko Thyson wrote:

Dear List,



I’m doing my first baby steps towards developing own R Packages and ran into
the following problem:


First baby step: Do not cross-post on several lists.




R CMD check mypackage works fine (no errors, no warnings)

R CMD build mypackage works fine (no errors, no warnings)

R CMD INSTALL –library=”C:\R\R-2.11.1\library”
“something\mypackage\mypackage_1.0.tar.gz” works fine (no errors, no
warnings)



However, when I try loading the package in an R-Session (version 2.11.1) via
“library(mypackage)”, R complains about the package being build before
version R-2.10.0 and tells me to rebuild it.



So the R that is in your PATH is  < 2.10.x
Change your PATH and add the R version your are actually working with

Uwe Ligges






Could this possibly be due to the fact that I have multiple R versions
installed (this also includes the most recent one, though)?



To provide you with some details:

-  Running Windows XP

-  All of my R versions are under “C:\R” (versions 2.9.2, 2.10.1,
2.11.1).

-  I installed Rtools (version 2.1.2) to “C:\Rtools” and pointed it
to “C:\R” (as this was the default) to interact with R (should this maybe
have been “C:\R\R-2.11.1”?). I also installed everything else necessary to
build packages (Inno Setup etc.).

-  My PATH is set up as explained in R-Admin manual. Also, the only
R version stated there is “C:\R\R-2.11.1\bin;”.

-  I updated the DESCRIPTION file and specified all .Rd files
correctly.



Any idea what I’m doing wrong?



Thanks a ton,

Janko



   _



Janko Thyson
    janko.thy...@ku-eichstaett.de

Catholic University of Eichstätt-Ingolstadt
Ingolstadt School of Management
Statistics and Quantitative Methods
Auf der Schanz 49
D-85049 Ingolstadt

    www.wfi.edu/lsqm

Fon:  +49 841 937-1923
Fax:  +49 841 937-1965

This e-mail and any attachment is for authorized use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be
copied, disclosed to, retained or used by any other party.
If you are not an intended recipient then please promptly delete this
e-mail and any attachment and all copies and inform the sender.



   _




[[alternative HTML version deleted]]




__
r-h...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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


Re: [Rd] [R] Problems building own package (Error: "package has been build before R-2.10.0")

2010-08-17 Thread Janko Thyson
> -Ursprüngliche Nachricht-
> Von: Uwe Ligges [mailto:lig...@statistik.tu-dortmund.de]
> Gesendet: Dienstag, 17. August 2010 22:00
> An: Janko Thyson
> Cc: r-de...@r-project. org
> Betreff: Re: [R] Problems building own package (Error: "package has
> been build before R-2.10.0")
> 
> 
> 
> On 17.08.2010 20:36, Janko Thyson wrote:
> > Dear List,
> >
> >
> >
> > I’m doing my first baby steps towards developing own R Packages and
> ran into
> > the following problem:
> 
> First baby step: Do not cross-post on several lists.

Sorry.

> > R CMD check mypackage works fine (no errors, no warnings)
> >
> > R CMD build mypackage works fine (no errors, no warnings)
> >
> > R CMD INSTALL –library=”C:\R\R-2.11.1\library”
> > “something\mypackage\mypackage_1.0.tar.gz” works fine (no errors, no
> > warnings)
> >
> >
> >
> > However, when I try loading the package in an R-Session (version
> 2.11.1) via
> > “library(mypackage)”, R complains about the package being build
> before
> > version R-2.10.0 and tells me to rebuild it.
> 
> 
> So the R that is in your PATH is  < 2.10.x
> Change your PATH and add the R version your are actually working
> with

As I wrote: "My PATH is set up as explained in the R-Admin manual. Also, the
only R version stated there is “C:\R\R-2.11.1\bin;”.

> Uwe Ligges
>
>
> >
> >
> > Could this possibly be due to the fact that I have multiple R
> versions
> > installed (this also includes the most recent one, though)?
> >
> >
> >
> > To provide you with some details:
> >
> > -  Running Windows XP
> >
> > -  All of my R versions are under “C:\R” (versions 2.9.2,
> 2.10.1,
> > 2.11.1).
> >
> > -  I installed Rtools (version 2.1.2) to “C:\Rtools” and
> pointed it
> > to “C:\R” (as this was the default) to interact with R (should this
> maybe
> > have been “C:\R\R-2.11.1”?). I also installed everything else
> necessary to
> > build packages (Inno Setup etc.).
> >
> > -  My PATH is set up as explained in R-Admin manual. Also,
> the only
> > R version stated there is “C:\R\R-2.11.1\bin;”.
> >
> > -  I updated the DESCRIPTION file and specified all .Rd files
> > correctly.
> >
> >
> >
> > Any idea what I’m doing wrong?
> >
> >
> >
> > Thanks a ton,
> >
> > Janko
> >
> >
> >
> >_
> >
> >
> >
> > Janko Thyson
> >     janko.thy...@ku-
> eichstaett.de
> >
> > Catholic University of Eichstätt-Ingolstadt
> > Ingolstadt School of Management
> > Statistics and Quantitative Methods
> > Auf der Schanz 49
> > D-85049 Ingolstadt
> >
> >     www.wfi.edu/lsqm
> >
> > Fon:  +49 841 937-1923
> > Fax:  +49 841 937-1965
> >
> > This e-mail and any attachment is for authorized use by the intended
> > recipient(s) only. It may contain proprietary material, confidential
> > information and/or be subject to legal privilege. It should not be
> > copied, disclosed to, retained or used by any other party.
> > If you are not an intended recipient then please promptly delete this
> > e-mail and any attachment and all copies and inform the sender.
> >
> >
> >
> >_
> >
> >
> >
> >
> > [[alternative HTML version deleted]]
> >
> >
> >
> >
> > __
> > r-h...@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> > and provide commented, minimal, self-contained, reproducible code.

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


Re: [Rd] [R] Problems building own package (Error: "package has been build before R-2.10.0")

2010-08-17 Thread Uwe Ligges
Then, you have the package installed under another libarry that is first 
on your search path.


Uwe Ligges

On 17.08.2010 22:07, Janko Thyson wrote:

-Ursprüngliche Nachricht-
Von: Uwe Ligges [mailto:lig...@statistik.tu-dortmund.de]
Gesendet: Dienstag, 17. August 2010 22:00
An: Janko Thyson
Cc: r-de...@r-project. org
Betreff: Re: [R] Problems building own package (Error: "package has
been build before R-2.10.0")



On 17.08.2010 20:36, Janko Thyson wrote:

Dear List,



I’m doing my first baby steps towards developing own R Packages and

ran into

the following problem:


First baby step: Do not cross-post on several lists.


Sorry.


R CMD check mypackage works fine (no errors, no warnings)

R CMD build mypackage works fine (no errors, no warnings)

R CMD INSTALL –library=”C:\R\R-2.11.1\library”
“something\mypackage\mypackage_1.0.tar.gz” works fine (no errors, no
warnings)



However, when I try loading the package in an R-Session (version

2.11.1) via

“library(mypackage)”, R complains about the package being build

before

version R-2.10.0 and tells me to rebuild it.



So the R that is in your PATH is<  2.10.x
Change your PATH and add the R version your are actually working
with


As I wrote: "My PATH is set up as explained in the R-Admin manual. Also, the
only R version stated there is “C:\R\R-2.11.1\bin;”.


Uwe Ligges





Could this possibly be due to the fact that I have multiple R

versions

installed (this also includes the most recent one, though)?



To provide you with some details:

-  Running Windows XP

-  All of my R versions are under “C:\R” (versions 2.9.2,

2.10.1,

2.11.1).

-  I installed Rtools (version 2.1.2) to “C:\Rtools” and

pointed it

to “C:\R” (as this was the default) to interact with R (should this

maybe

have been “C:\R\R-2.11.1”?). I also installed everything else

necessary to

build packages (Inno Setup etc.).

-  My PATH is set up as explained in R-Admin manual. Also,

the only

R version stated there is “C:\R\R-2.11.1\bin;”.

-  I updated the DESCRIPTION file and specified all .Rd files
correctly.



Any idea what I’m doing wrong?



Thanks a ton,

Janko



_



Janko Thyson
      janko.thy...@ku-

eichstaett.de


Catholic University of Eichstätt-Ingolstadt
Ingolstadt School of Management
Statistics and Quantitative Methods
Auf der Schanz 49
D-85049 Ingolstadt

      www.wfi.edu/lsqm

Fon:  +49 841 937-1923
Fax:  +49 841 937-1965

This e-mail and any attachment is for authorized use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be
copied, disclosed to, retained or used by any other party.
If you are not an intended recipient then please promptly delete this
e-mail and any attachment and all copies and inform the sender.



_




[[alternative HTML version deleted]]




__
r-h...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-

guide.html

and provide commented, minimal, self-contained, reproducible code.




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


Re: [Rd] DetachedEval Issues

2010-08-17 Thread Simon Urbanek

On Aug 17, 2010, at 9:32 AM, Martin Kerr wrote:

> 
> Hello everyone,
> I have been attempting to make use of the newly implemented detachedEval 
> functionality and I am having a few teething issues.

I presume you're talking about Rserve? Please use the proper mailing list 
rosuda-stats-devel for that.


> My code works fine when tested with both the Client and the Server on a 
> single machine, but issues arise when I run them separately.Possibly because 
> the local / local connection is running voer a Unix socket rather than tcp 
> proper?
> Rsession* theSession;theSession = 
> rc->detachedEval("source(\"hdlc_processing.r\")");delete rc;
> rc = new Rconnection(theSession);rc->connect();
> 
> Owing to firewall issues I am having to make use of an ssh tunnel for the 
> connection, hence the manual override of the port number.

Which is entirely wrong - sessions don't re-attach to the server but to the 
random port generated on detach by the client.

Cheers,
Simon



> Thus I am in fact using this:
> Rsession* testSession = new 
> Rsession(theSession->host(),6311,theSession->key());rc = new 
> Rconnection(testSession);rc->connect();
> This results in the following being outputted on the Rserve debug side.
> session: resuming session, waiting for connections.connection 
> accepted.sending ID string.
> header read result: 16DUMP [16]: 31 be 18 07 15 57 93 6f 9d a3 53 56 99 f4 3b 
> 7fdiscarding buffer because too big (awaiting 1871927061 bytes)
> Any help would be greatly appreciated.
> Thank You
> Martin Kerr
> 
>   [[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] parent.frame(1) of a S4 method is not a calling environment.

2010-08-17 Thread Vitaly S.
Duncan Murdoch  writes:

> Vitaly S. wrote:
>> Martin Morgan  writes:
>>   
 So,  can I be sure that for such functions parent.frame(2) will always 
 work?
 What are the additional rules?
   
>>> callNextMethod() will cause additional problems; the idea that you'll
>>> grab things from somewhere other than function arguments doesn't seem
>>> like a robust design, even if it's used in some important parts of R.
>>>
>>> Martin
>>>
>>> 
>>
>> That make it difficult to handle unevaluated expressions in methods. A 
>> solution
>> would be to explicitly require the users to use quote() or expression(),  and
>> then to use the "expression" in the signature. Slightly unpleasant, though.
>>
>>   
>
> You could use formulas for that.  If you pass in
>
> formula = ~ x + y*z
>
> then environment(formula) will be the right evaluation environment, and 
> formula[[2]] will be the unevaluated x +
> y*z.
>
> Duncan Murdoch

Thank you Duncan, I didn't know that.

For programmatic use though, formula interface is slightly inconvenient. A
specialized function and class would be desirable. With the advent of more and
more complex S4 classes, unevaluated expressions in methods calls will became a
necessity, that's my feeling.

Thank you.
Vitaly.

>
>> Standardised, simpler syntax like .() in  ggplot and plyr,  would be handy 
>> here.
>> Hopefully .() is not grabbed for something else in meanwhile:).
>>
>> Vitaly.
>>
>> __
>> 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] parent.frame(1) of a S4 method is not a calling environment.

2010-08-17 Thread Hadley Wickham
On Tuesday, August 17, 2010, Vitaly S.  wrote:
> Duncan Murdoch  writes:
>
>> Vitaly S. wrote:
>>> Martin Morgan  writes:
>>>
> So,  can I be sure that for such functions parent.frame(2) will always 
> work?
> What are the additional rules?
>
 callNextMethod() will cause additional problems; the idea that you'll
 grab things from somewhere other than function arguments doesn't seem
 like a robust design, even if it's used in some important parts of R.

 Martin


>>>
>>> That make it difficult to handle unevaluated expressions in methods. A 
>>> solution
>>> would be to explicitly require the users to use quote() or expression(),  
>>> and
>>> then to use the "expression" in the signature. Slightly unpleasant, though.
>>>
>>>
>>
>> You could use formulas for that.  If you pass in
>>
>> formula = ~ x + y*z
>>
>> then environment(formula) will be the right evaluation environment, and 
>> formula[[2]] will be the unevaluated x +
>> y*z.
>>
>> Duncan Murdoch
>
> Thank you Duncan, I didn't know that.
>
> For programmatic use though, formula interface is slightly inconvenient. A
> specialized function and class would be desirable. With the advent of more and
> more complex S4 classes, unevaluated expressions in methods calls will became 
> a
> necessity, that's my feeling.

I probably should move the quoting related out of plyr into it's own
package to facilitate this type of reuse. I think the current
structure is quite general.

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

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