[Rd] How do I use the new 'ByteCompile' field in R-2.14?

2011-11-02 Thread Slava Razbash
Hello,


I would like to the use the 'ByteCompile' field in R 2.14. However,
"Writing R Extensions" only describes this field, but does not say
what value it should be set to. How should i use it? Do you have
examples?

Is it the same as "LazyData: yes"?

Thank you,

Slava

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


[Rd] vignettes/

2011-11-02 Thread Paul Gilbert
I am experimenting with putting vignettes in a vignettes/ directory as 
suggested in the new R release news. If I understand correctly, it is now 
suggested that the vignette source (.Stex in my case) should be in the 
vignettes/  directory and the pdf should be put in the inst/doc/ directory, for 
the case when it is not being built by R CMD build.   I am getting an error 
(R-2.14.0):


(cd inst/doc ;  R CMD Sweave --pdf ../../vignettes/Guide.Stex  ) Writing to 
file Guide.tex Processing code chunks with options ...

...

You can now run (pdf)latex on 'Guide.tex'

Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet,  :

   Running 'texi2dvi' on '../../vignettes/Guide.tex' failed.

Messages:

/usr/bin/texi2dvi: cannot read ./../../vignettes/Guide.tex, skipping.

Calls:  ->  -> texi2dvi Execution halted

I can work around this by copying the Stex to inst/doc first,  but I think that 
Sweave -pdf should be able to find the .tex file it just wrote.

Also, I would appreciate suggestions about whether one should try to build the 
pdf in the vignettes/ directory and then move it to inst/doc, or build the pdf 
in inst/doc.   I suppose this all gets looked after by R CMD build if I have 
BuildVignettes: true, but otherwise I think I have to do it manually by 
something like the above, so I am trying to understand the preferred strategy.

Paul


La version française suit le texte anglais.



This email may contain privileged and/or confidential information, and the Bank 
of
Canada does not waive any related rights. Any distribution, use, or copying of 
this
email or the information it contains by other than the intended recipient is
unauthorized. If you received this email in error please delete it immediately 
from
your system and notify the sender promptly by email that you have done so. 



Le présent courriel peut contenir de l'information privilégiée ou 
confidentielle.
La Banque du Canada ne renonce pas aux droits qui s'y rapportent. Toute 
diffusion,
utilisation ou copie de ce courriel ou des renseignements qu'il contient par une
personne autre que le ou les destinataires désignés est interdite. Si vous 
recevez
ce courriel par erreur, veuillez le supprimer immédiatement et envoyer sans 
délai à
l'expéditeur un message électronique pour l'aviser que vous avez éliminé de 
votre
ordinateur toute copie du courriel reçu.

[[alternative HTML version deleted]]

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


[Rd] kernapply.ts

2011-11-02 Thread Pierre Chausse
I have a suggestion for kernapply for ts objects. When we choose the 
option circular=F, the returned series don't have the correct dates. The 
removed dates are all at the beginning instead of half at the beginning 
and half at the end. It is particularly useful when we need to smooth 
the series (or remove a trend using a filter) before estimating a model 
(like in macroeconomics) or simply to plot the  original series with the 
smoothed one. Of course, there is always the option of doing it by hand 
of the use circular=T and trim the series but I thought it would be 
nicer that way.

Here is my suggestion (maybe not the nicest way to do it but it works)


kernapply.ts <- function (x, k, circular = FALSE, ...)
{
 if (!is.matrix(x))
 {
 y <- kernapply.vector(as.vector(x), k, circular=circular)
 ts (y, end=end(x), frequency=frequency(x))
 }
 else
 y <- apply(x, MARGIN=2L, FUN=kernapply, k, circular=circular)

 if(circular)
 ts (y, end=end(x), frequency=frequency(x))
 else
 {
 y <- as.ts(y)
 t1 <- tsp(x)[1]+(length(k[[1]])-1)/tsp(x)[3]
 t2 <- tsp(x)[2]-(length(k[[1]])-1)/tsp(x)[3]
 tsp(y) <- c(t1,t2,tsp(x)[3])
 return(y)
 }
}

-- 
*Pierre Chaussé*
Assistant Professor
Department of Economics
University of Waterloo

[[alternative HTML version deleted]]

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


Re: [Rd] Question about copying reference objects using the initialize method

2011-11-02 Thread Aleix Ruiz de Villa
Martin,

thanks. So then I should use options (3) or (4). That's all. Is there
an efficient way to initialize arguments if I have a long list of
arguments? maybe using a 'list'? so that the header of the function is
displayed in a friendly style?

Thanks again!

2011/11/1 Martin Morgan :
> On 10/31/2011 08:53 AM, Aleix Ruiz de Villa wrote:
>>
>> Dears,
>>
>> I have a question about copying reference objects using the initialize
>> method.
>>
>> 1) If the latter has no arguments, there is no problem to copy an object.
>>
>> myClass = setRefClass("myClass", fields = list(value = "numeric") )
>>
>> myClass$methods(initialize = function(...){
>>
>>   value<<- 1
>>
>>   callSuper(...)
>> })
>>
>> newObject = myClass$new()
>> newObject$value = 2
>> copyObject = newObject$copy()
>> copyObject$value = 3
>> print(newObject$value)
>> print(copyObject$value)
>>
>>
>> 2) However, if the initialize method has arguments, I get an error:
>>
>> myClass = setRefClass("myClass", fields = list(value = "numeric") )
>> myClass$methods(initialize = function(extValue, ...){
>>
>>   value<<- extValue
>>
>>   callSuper(...)
>> })
>> newObject = myClass$new(extValue = 2)
>> copyObject = newObject$copy()
>>
>> Error in .Object$initialize(...) :
>>   argument "extValue" is missing, with no default
>>
>>
>> I understand that copy() first builds another instance of the object
>> and then copies the fields. But it calls new without arguments...
>>
>> 3) One solution would be the initialize values by default
>>
>> myClass = setRefClass("myClass", fields = list(value = "numeric") )
>>
>> myClass$methods(initialize = function(extValue = 1, ...){
>>
>>   value<<- extValue
>>
>>   callSuper(...)
>> })
>>
>> newObject = myClass$new(extValue = 2)
>> copyObject = newObject$copy()
>>
>>
>> But I have a long list of arguments, so this way would be a little
>> uncomfortable. On the other hand, I've been told that in OOP, the idea
>> of the initialise method is to use the minimum information to build
>> the oject. So passing a long list of arguments is not a good idea.
>>
>>
>> 4) Another option is to first build the object and then set the parameters
>>
>> myClass = setRefClass("myClass", fields = list(value = "numeric") )
>>
>> myClass$methods(setPar = function(extValue = 1, ...){
>>
>>   value<<- extValue
>>
>>   return()
>> })
>>
>> newObject = myClass$new()
>> newObject$setPar(extValue = 2)
>> copyObject = newObject$copy()
>>
>>
>> It works fine.
>>
>> Anyway I am curious to know if there is any way to use the initialize
>> method with arguments that is not a problem with copy().
>
> Hi Aleix --
>
> From ?setRefClass
>
>          Initialization methods
>          need some care in design, as they do for S4 classes. In
>          particular, remember that others may subclass your class and
>          pass through field assignments or other arguments.
>          Therefore, your method should normally include ... as an
>          argument, all other arguments should have defaults or check
>          for missingness, and your method should pass all initialized
>          values on via '$callSuper()' or '$initFields()' if you know
>          that your superclasses have no initialization methods.
>
> so it sounds like your initialize method arguments are expected to have
> default values. My preferred signature would place the '...' first, so that
> unnamed arguments (super-classes) are not unintentionally matched to named
> arguments.
>
> Martin
>
>>
>>
>> Thank!
>>
>> Aleix Ruiz de Villa
>>
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>
> --
> Computational Biology
> Fred Hutchinson Cancer Research Center
> 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109
>
> Location: M1-B861
> Telephone: 206 667-2793
>

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


Re: [Rd] How do I use the new 'ByteCompile' field in R-2.14?

2011-11-02 Thread Joshua Wiley
Hi Slava,

Here is what I have in my DESCRIPTION:

ByteCompile: true

seems to work for me.

Cheers,

Josh

On Wed, Nov 2, 2011 at 3:27 AM, Slava Razbash  wrote:
> Hello,
>
>
> I would like to the use the 'ByteCompile' field in R 2.14. However,
> "Writing R Extensions" only describes this field, but does not say
> what value it should be set to. How should i use it? Do you have
> examples?
>
> Is it the same as "LazyData: yes"?
>
> Thank you,
>
> Slava
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, ATS Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.com/

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


Re: [Rd] kernapply.ts

2011-11-02 Thread Prof Brian Ripley

On Wed, 2 Nov 2011, Pierre Chausse wrote:


I have a suggestion for kernapply for ts objects. When we choose the
option circular=F, the returned series don't have the correct dates. The


That's a matter of opinion.  A kernel is applied in the same way as an 
MA filter, to historical data.



removed dates are all at the beginning instead of half at the beginning
and half at the end. It is particularly useful when we need to smooth
the series (or remove a trend using a filter) before estimating a model
(like in macroeconomics) or simply to plot the  original series with the
smoothed one. Of course, there is always the option of doing it by hand
of the use circular=T and trim the series but I thought it would be
nicer that way.

Here is my suggestion (maybe not the nicest way to do it but it works)


kernapply.ts <- function (x, k, circular = FALSE, ...)
{
if (!is.matrix(x))
{
y <- kernapply.vector(as.vector(x), k, circular=circular)
ts (y, end=end(x), frequency=frequency(x))
}
else
y <- apply(x, MARGIN=2L, FUN=kernapply, k, circular=circular)

if(circular)
ts (y, end=end(x), frequency=frequency(x))
else
{
y <- as.ts(y)
t1 <- tsp(x)[1]+(length(k[[1]])-1)/tsp(x)[3]
t2 <- tsp(x)[2]-(length(k[[1]])-1)/tsp(x)[3]
tsp(y) <- c(t1,t2,tsp(x)[3])
return(y)
}
}

--
*Pierre Chauss?*
Assistant Professor
Department of Economics
University of Waterloo

[[alternative HTML version deleted]]




--
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] extra & in some lines of R KEYWORDS file

2011-11-02 Thread Paul Johnson
The KEYWORDS file (on R 2.13.1 anyway) , seems to have some extra "&" symbols.
Look below at "&" before "character" "complex" "category" and "NA"

?intentional or mistaken? If not mistaken, what do the & mean?

Basics
sysdata &   Basic System Variables  [!= S]
datasets&   Datasets available by data(.)   [!= S]
data&   Environments, Scoping, Packages [~= S]
manip   &   Data Manipulation
attribute   &   Data Attributes
classes &   Data Types (not OO)
& character &   Character Data ("String") Operations
& complex   &   Complex Numbers
& category  &   Categorical Data
& NA&   Missing Values  [!= S]
list&   Lists
chron   &   Dates and Times
package &   Package Summaries


-- 
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

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


Re: [Rd] extra & in some lines of R KEYWORDS file

2011-11-02 Thread Prof Brian Ripley

On Wed, 2 Nov 2011, Paul Johnson wrote:


The KEYWORDS file (on R 2.13.1 anyway) , seems to have some extra "&" symbols.
Look below at "&" before "character" "complex" "category" and "NA"

?intentional or mistaken? If not mistaken, what do the & mean?


Both!  The mistake is all yours, however.

Compare with the KEYWORDS.db file or the keyword listing on the HTML 
search page.




Basics
   sysdata &   Basic System Variables  [!= S]
   datasets&   Datasets available by data(.)   [!= S]
   data&   Environments, Scoping, Packages [~= S]
   manip   &   Data Manipulation
   attribute   &   Data Attributes
   classes &   Data Types (not OO)
   & character &   Character Data ("String") Operations
   & complex   &   Complex Numbers
   & category  &   Categorical Data
   & NA&   Missing Values  [!= S]
   list&   Lists
   chron   &   Dates and Times
   package &   Package Summaries


--
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

__
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


Re: [Rd] kernapply.ts

2011-11-02 Thread Pierre Chausse
On 02/11/11 12:20 PM, Prof Brian Ripley wrote:
> On Wed, 2 Nov 2011, Pierre Chausse wrote:
>
>> I have a suggestion for kernapply for ts objects. When we choose the
>> option circular=F, the returned series don't have the correct dates. The
>
> That's a matter of opinion.  A kernel is applied in the same way as an 
> MA filter, to historical data.


I understand for MA which is the weighted sum of past data but kernapply 
does not average present and past values of the series X(t) but values 
around it

ex. with length(k[[1]])=2

Smoothed(X_t) = k[[1]][2] X_{t-1} + k[[1]][1] X_{t} + k[[1]][2] X_{t+1}

which makes it natural to have the same date as X_t. Furthermore in the 
kernapply.vector which is used for time series, the function returns the 
following for circular=F

return (y[(1L+m):(n-m)])

In other words it removes the first ans last observations.

>
>> removed dates are all at the beginning instead of half at the beginning
>> and half at the end. It is particularly useful when we need to smooth
>> the series (or remove a trend using a filter) before estimating a model
>> (like in macroeconomics) or simply to plot the  original series with the
>> smoothed one. Of course, there is always the option of doing it by hand
>> of the use circular=T and trim the series but I thought it would be
>> nicer that way.
>>
>> Here is my suggestion (maybe not the nicest way to do it but it works)
>>
>>
>> kernapply.ts <- function (x, k, circular = FALSE, ...)
>> {
>> if (!is.matrix(x))
>> {
>> y <- kernapply.vector(as.vector(x), k, circular=circular)
>> ts (y, end=end(x), frequency=frequency(x))
>> }
>> else
>> y <- apply(x, MARGIN=2L, FUN=kernapply, k, circular=circular)
>>
>> if(circular)
>> ts (y, end=end(x), frequency=frequency(x))
>> else
>> {
>> y <- as.ts(y)
>> t1 <- tsp(x)[1]+(length(k[[1]])-1)/tsp(x)[3]
>> t2 <- tsp(x)[2]-(length(k[[1]])-1)/tsp(x)[3]
>> tsp(y) <- c(t1,t2,tsp(x)[3])
>> return(y)
>> }
>> }
>>
>> -- 
>> *Pierre Chauss?*
>> Assistant Professor
>> Department of Economics
>> University of Waterloo
>>
>> [[alternative HTML version deleted]]
>>
>>
>


-- 
*Pierre Chaussé*
Assistant Professor
Department of Economics
University of Waterloo

[[alternative HTML version deleted]]

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


[Rd] Writing new methods for `names<-`

2011-11-02 Thread Max Gasner
Hi there,

I'm working with an object whose internal data representation is very
different from a data.frame (data is stored as a list of big.matrix objects
from the bigmemory package) but to which I'd like to give users
data.frame-like access. I've implemented names very easily as follows:

setMethod("names", signature = "my.dataset", definition = function (x) {
  x@colnames
})

Now I'd like to implement `names<-` analogously.

Of course the following does not work, because only the local copy of the
dataset is changed:

setMethod("names<-", signature = "my.dataset", definition = function (x,
value) {
  x@colnames <- value
})

Following a suggestion I found in the list archives, I thought it might be
worthwhile to try something like the following:

setMethod("names<-", signature = "my.dataset", definition = function (x,
value, env = parent.frame()) {
  with(parent.frame(), x@colnames <- value)
})

But of course because `names<-` is primitive, if I try to redefine the
generic function as follows so I can pass it another argument:

setGeneric("names<-", def = function (x, value, ...) {
standardGeneric("names<-") })

Then I get the following error:

Error in setGeneric("names<-", def = function(x, value, ...) { :
  ‘names<-’ is a primitive function;  methods can be defined, but the
generic function is implicit, and cannot be changed.

Any advice on ways around this, or other approaches to the problem, would
be very welcome!

Thanks,

Max



Max Gasner
Navia Systems | 415 413 3821

[[alternative HTML version deleted]]

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


[Rd] overly long lines in pdf output of manual from package

2011-11-02 Thread John C Nash
In re-factoring my optimx package, I'm finding that the pdf output has some 
lines that are
outside the margins (and there are warnings in R CMD check optimx). Clearly I 
can fix this
by editing the tex file that is generated, but the build infrastructure would 
still get
things wrong in automatic processing. So that gives rise to 3 questions:

1) How do I adjust the DESCRIPTION file to avoid too long a line (optimx uses a 
lot of
other packages). I can add \cr elements to the Rd files to control those lines, 
but
DESCRIPTION doesn't allow this.

2) Is there an option control that does the job? I've not found one in 
searching, but
could easily have chosen poor search terms.

3) To avoid running the whole of R CMD check to rebuild the manual, do I need 
to dig into
R CMD check to find the bits that just build the manual, or is there an option 
to Rd2pdf
to do this? I've found how to process a list of files with Rd2pdf, but need to 
add the
DESCRIPTION stuff.

Best

John Nash

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


Re: [Rd] Sweave, cairo_pdf, xetex, CJK (Re: Sweave, cairo_pdf, CJK, ghostscript)

2011-11-02 Thread Hin-Tak Leung
FWIW, this is the final outcome: Chinese, Tibetan, Arabic, Liangshan Yi 
(basically Chinese + 3 other languages used in Nw and Sw china). Arabic is 
interesting, it using a right-to-left layout - and it works in R graphics.

http://sourceforge.net/projects/outmodedbonsai/files/snpMatrix%20next/1.19.0.11/China_Geographical_Distribution_Maps.pdf/download


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


Re: [Rd] Writing new methods for `names<-`

2011-11-02 Thread Martin Morgan

On 11/02/2011 11:57 AM, Max Gasner wrote:

Hi there,

I'm working with an object whose internal data representation is very
different from a data.frame (data is stored as a list of big.matrix objects
from the bigmemory package) but to which I'd like to give users
data.frame-like access. I've implemented names very easily as follows:

setMethod("names", signature = "my.dataset", definition = function (x) {
   x@colnames
})

Now I'd like to implement `names<-` analogously.

Of course the following does not work, because only the local copy of the
dataset is changed:

setMethod("names<-", signature = "my.dataset", definition = function (x,
value) {
   x@colnames<- value
})

Following a suggestion I found in the list archives, I thought it might be
worthwhile to try something like the following:

setMethod("names<-", signature = "my.dataset", definition = function (x,
value, env = parent.frame()) {
   with(parent.frame(), x@colnames<- value)
})

But of course because `names<-` is primitive, if I try to redefine the
generic function as follows so I can pass it another argument:

setGeneric("names<-", def = function (x, value, ...) {
standardGeneric("names<-") })

Then I get the following error:

Error in setGeneric("names<-", def = function(x, value, ...) { :
   ‘names<-’ is a primitive function;  methods can be defined, but the
generic function is implicit, and cannot be changed.

Any advice on ways around this, or other approaches to the problem, would
be very welcome!


Hi Max --

'names<-' is already a generic

> getGeneric("names<-")
standardGeneric for "names<-" defined from package "base"

function (x, value)
standardGeneric("names<-", .Primitive("names<-"))

Methods may be defined for arguments: x, value
Use  showMethods("names<-")  for currently available ones.

so write a 'replacement' method

setReplaceMethod("names", "my.dataset", function(x, value) {
x@colnames <- value
x
})

Hope that helps,

Martin



Thanks,

Max



Max Gasner
Navia Systems | 415 413 3821

[[alternative HTML version deleted]]




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



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

Location: M1-B861
Telephone: 206 667-2793

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


Re: [Rd] Question about copying reference objects using the initialize method

2011-11-02 Thread Martin Morgan

On 11/02/2011 08:16 AM, Aleix Ruiz de Villa wrote:

Martin,

thanks. So then I should use options (3) or (4). That's all. Is there
an efficient way to initialize arguments if I have a long list of
arguments? maybe using a 'list'? so that the header of the function is
displayed in a friendly style?


Hi -- I'm not really understanding your question.

Martin



Thanks again!

2011/11/1 Martin Morgan:

On 10/31/2011 08:53 AM, Aleix Ruiz de Villa wrote:


Dears,

I have a question about copying reference objects using the initialize
method.

1) If the latter has no arguments, there is no problem to copy an object.

myClass = setRefClass("myClass", fields = list(value = "numeric") )

myClass$methods(initialize = function(...){

   value<<- 1

   callSuper(...)
})

newObject = myClass$new()
newObject$value = 2
copyObject = newObject$copy()
copyObject$value = 3
print(newObject$value)
print(copyObject$value)


2) However, if the initialize method has arguments, I get an error:

myClass = setRefClass("myClass", fields = list(value = "numeric") )
myClass$methods(initialize = function(extValue, ...){

   value<<- extValue

   callSuper(...)
})
newObject = myClass$new(extValue = 2)
copyObject = newObject$copy()

Error in .Object$initialize(...) :
   argument "extValue" is missing, with no default


I understand that copy() first builds another instance of the object
and then copies the fields. But it calls new without arguments...

3) One solution would be the initialize values by default

myClass = setRefClass("myClass", fields = list(value = "numeric") )

myClass$methods(initialize = function(extValue = 1, ...){

   value<<- extValue

   callSuper(...)
})

newObject = myClass$new(extValue = 2)
copyObject = newObject$copy()


But I have a long list of arguments, so this way would be a little
uncomfortable. On the other hand, I've been told that in OOP, the idea
of the initialise method is to use the minimum information to build
the oject. So passing a long list of arguments is not a good idea.


4) Another option is to first build the object and then set the parameters

myClass = setRefClass("myClass", fields = list(value = "numeric") )

myClass$methods(setPar = function(extValue = 1, ...){

   value<<- extValue

   return()
})

newObject = myClass$new()
newObject$setPar(extValue = 2)
copyObject = newObject$copy()


It works fine.

Anyway I am curious to know if there is any way to use the initialize
method with arguments that is not a problem with copy().


Hi Aleix --

 From ?setRefClass

  Initialization methods
  need some care in design, as they do for S4 classes. In
  particular, remember that others may subclass your class and
  pass through field assignments or other arguments.
  Therefore, your method should normally include ... as an
  argument, all other arguments should have defaults or check
  for missingness, and your method should pass all initialized
  values on via '$callSuper()' or '$initFields()' if you know
  that your superclasses have no initialization methods.

so it sounds like your initialize method arguments are expected to have
default values. My preferred signature would place the '...' first, so that
unnamed arguments (super-classes) are not unintentionally matched to named
arguments.

Martin




Thank!

Aleix Ruiz de Villa

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



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

Location: M1-B861
Telephone: 206 667-2793




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

Location: M1-B861
Telephone: 206 667-2793

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


Re: [Rd] overly long lines in pdf output of manual from package

2011-11-02 Thread Prof Brian Ripley

On Wed, 2 Nov 2011, John C Nash wrote:


In re-factoring my optimx package, I'm finding that the pdf output has some 
lines that are
outside the margins (and there are warnings in R CMD check optimx). Clearly I 
can fix this
by editing the tex file that is generated, but the build infrastructure would 
still get
things wrong in automatic processing. So that gives rise to 3 questions:

1) How do I adjust the DESCRIPTION file to avoid too long a line (optimx uses a 
lot of
other packages). I can add \cr elements to the Rd files to control those lines, 
but
DESCRIPTION doesn't allow this.


Wrap lines?  And is this R 2.14.0, as the issues are easier with 
the fonts used there?


2) Is there an option control that does the job? I've not found one 
in searching, but could easily have chosen poor search terms.


R has ways to reformat description files.  See ?write.dcf.



3) To avoid running the whole of R CMD check to rebuild the manual, 
do I need to dig into R CMD check to find the bits that just build 
the manual, or is there an option to Rd2pdf to do this? I've found 
how to process a list of files with Rd2pdf, but need to add the 
DESCRIPTION stuff.


R CMD R2pdf on a package source directory is what R CMD check uses.



Best

John Nash

__
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


Re: [Rd] overly long lines in pdf output of manual from package

2011-11-02 Thread John C Nash
Thanks for quick reply.

To help others I'll put in short comments in edited thread.

On 11/02/2011 03:54 PM, Prof Brian Ripley wrote:
> On Wed, 2 Nov 2011, John C Nash wrote:
> 
>> In re-factoring my optimx package, I'm finding that the pdf output has some 
>> lines that are
>> outside the margins (and there are warnings in R CMD check optimx). 

>> 1) How do I adjust the DESCRIPTION file to avoid too long a line. I can add 
>> \cr elements to the Rd...
> 
> Wrap lines?  And is this R 2.14.0, as the issues are easier with the fonts 
> used there?

R 2.14.0 -- installed from M Rutter repository today. I don't know why it wraps 
sometimes
and not others, but have occasionally seen similar over-long lines with other 
TEX files
with the TeXlive I'm using, even with the texlive-fonts-extra installed.

> 
>> 2) Is there an option control that does the job? I've not found one in 
>> searching, but
>> could easily have chosen poor search terms.
> 
> R has ways to reformat description files.  See ?write.dcf.

Thanks. I would not have found that! Hence example lines would be

Depends: pkg1, pkg2, pkg3,
pkg4, pkg5, pkg6.

i.e., spaces on second line.

>> 3) To avoid running the whole of R CMD check ...
> 
> R CMD R2pdf on a package source directory is what R CMD check uses.
> 
When in directory just above that with optimx package in it:

   R CMD Rd2pdf optimx

works quickly and well. Note Rd2pdf not R2pdf (I only noticed just now). I had
misunderstood the Rd2pdf manual about directories. My bad.

JN

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


[Rd] Call function only when running via R CMD check?

2011-11-02 Thread Henrik Bengtsson
I'd like to be able to change some default settings only in the case
when checking a package with 'R CMD check'.  More precisely, I'd like
to execute a piece of R code before the Rd examples and/or test
scripts are evaluated by 'R CMD check'.  Is there a mechanism in 'R
CMD check' that makes this possible?  If not, is there a way to detect
that you are running via 'R CMD check', e.g. an R or an environment
variable being set?

The background for this is that some of my packages' examples are
using memoization to cache computational expensive results (via the
'R.cache' package).  These are cached to files which are by default
stored under ~/.Rcache/.   It turns out that these files live beyond
the check cycle of the CRAN check servers, meaning that the next time
the package is checked memoized results will be picked up.  If I could
detect that we're running via 'R CMD check', then I could change the
default cache directory to a temporary directory (e.g. tempdir()) that
will be clean out automatically.

This is not a critical problem, because for now I could explicitly
turn off the memoization in the code of my examples/regression tests,
but the above would be a more generic solution.

Thanks

Henrik

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