Re: [Rd] Windows problem related to using shortPathName for Sweave style file

2008-04-13 Thread Prof Brian Ripley
A follow up on the actions taken.

1) In R >= 2.7.0 whether Sweave() inserts

\usepackage{/full/path/to/Sweave}

is controlled by the environment variable SWEAVE_STYLEPATH_DEFAULT which 
sets the default for RweaveLatex's 'stylepath' argument.  So setting 
SWEAVE_STYLEPATH_DEFAULT=FALSE inserts just \usepackage{Sweave}

To work with this, when tools::texi2dvi finds it is being used with 
MiKTeX's texi2dvi, it makes use of the -I argument of the latter to put 
the path to Sweave.sty into the input path.

This means that users of MiKTeX will want to set 
SWEAVE_STYLEPATH_DEFAULT=FALSE in their environent, e.g. in .Renviron.


2) For 2.8.0, it is planned that the default for 'stylepath' will become 
FALSE.  In that version tools::texi2dvi will set the appropriate input 
path on all platforms.


On Thu, 10 Apr 2008, Patrick Aboyoun wrote:

> Thanks Duncan,
> I just did a survey of the BioConductor repository and only 4 of the 354
> .Rnw vignette files contain the \usepackage{Sweave} specification.
> Adding this is tedious, but not impossible. If the \usepackage{Sweave}
> specification does become recommended, could you add a WARNING to the R
> CMD build/check process if a vignette file lacks it? That would help
> steer developers in the right direction for cross-platform compatibility
> since most R package developers don't use Windows as their primary platform.
>
>
> Cheers,
> Patrick
>
>
> Duncan Murdoch wrote:
>> On 4/9/2008 9:50 PM, Patrick Aboyoun wrote:
>>> I forgot to mention the BioConductor Windows build machine is running
>>> Microsoft Windows Server 2003 R2
>>> Enterprise Edition, SP2
>>>
>>> I just checked and this same problem exists if I place R in the
>>> standard "C:\Program Files\R" location on this machine.
>>
>> We're going to roll back that change, so you should be okay with your
>> original setup.  As far as I know there is no way to get MikTeX to
>> work if you have a space in your pathname, so putting R in the
>> standard location will fail, unless you follow the advice I give below.
>>
>>> For now the backup plan is to move to using short path names for
>>> BioConductor builds (modifying 100+ vignettes is impractical as well
>>> as configuring MiKTeX to handle multiple installs of R that the build
>>> machine uses). If there is an alternate configuration that I should
>>> be using, just let me know.
>>
>> I would recommend biting the bullet and adding \usepackage{Sweave} to
>> every vignette.  It's just a one line addition to them, and it will
>> mean that their .tex output will work if you move it to a different
>> machine, where the full path to Sweave.sty is different.
>>
>> Duncan Murdoch
>>
>>>
>>>
>>> Cheers,
>>> Patrick
>>>
>>>
>>> Duncan Murdoch wrote:
 On 09/04/2008 5:23 PM, Patrick Aboyoun wrote:
> Something funky happened to my e-mail. I was trying to paste
> information related to MiKTeX and R into my message and it appears
> to have corrupted the text somehow. Anyway, the message I was
> trying to get across is that the tex file contains the path
>
> \usepackage{E:/paboyoun/BBS-2~1.2-B/R/share/texmf/Sweave}
>
> and MiKTeX 2.7 doesn't know how to resolve it. (The
> Bioconductor.tex file is (hopefully) attached to this e-mail.)

 You should be able to get things to work by explicitly putting

 \usepackage{Sweave}

 somewhere early in your .Rnw file.  You may have trouble with MikTeX
 finding Sweave.sty, depending how you invoke it:  if invoked from R
 CMD it should work, but maybe not from your command line unless you
 tell it where to look for include files.  How you do that changes
 all the time; R tries a couple, which is why R CMD probably works.

 Duncan Murdoch

>
>
> === BEGIN OS BLOCK ===
>
> E:\paboyoun>pdflatex --version
> MiKTeX-pdfTeX 2.7.2987 (1.40.7) (MiKTeX 2.7)
> Copyright (C) 1982 D. E. Knuth, (C) 1996-2006 Han The Thanh
> TeX is a trademark of the American Mathematical Society.
>
> E:\paboyoun>pdflatex Bioconductor.tex
> This is pdfTeX, Version 3.141592-1.40.7 (MiKTeX 2.7)
> entering extended mode
> (Bioconductor.tex
> LaTeX2e <2005/12/01>
> Babel  and hyphenation patterns for english, dumylang,
> nohyphenation, ge
> rman, ngerman, french, loaded.
> ("C:\Program Files\MiKTeX 2.7\tex\latex\base\article.cls"
> Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
> ("C:\Program Files\MiKTeX 2.7\tex\latex\base\size12.clo"))
> ("C:\Program Files\MiKTeX 2.7\tex\latex\psnfss\times.sty")
> ("C:\Program Files\MiKTeX 2.7\tex\latex\hyperref\hyperref.sty"
> ("C:\Program Files\MiKTeX 2.7\tex\latex\graphics\keyval.sty")
> ("C:\Program Files\MiKTeX 2.7\tex\latex\oberdiek\hycolor.sty")
> ("C:\Program Files\MiKTeX 2.7\tex\latex\hyperref\pd1enc.def")
> ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\etexcmds.sty"
> ("C:\Program Files\MiKTeX 2.7\tex\generic\ob

[Rd] R 2.7 package.skeleton

2008-04-13 Thread cgenolin
Hi the devel list

I am testing package.skeleton in R 2.7 (download today). I get an error 
that I do not understand. I guess it is not an error from my code since 
I have no probleme when I source it. So is it a error in 
package.skeleton?

Here is my code :


--- 8< -- File essai.r -
setClass(
   Class="ClusterizLongData",
   representation=representation(
 clusterizS="list"
   ),
   prototype=prototype(
 clusterizS=list(c2=list(),c3=list())
   )
)
--- 8< -


package.skeleton("kmt",code_files=c("essai.r"))

Erreur dans .prototype(...) :  l'argument "list" est manquant, avec 
aucune valeur par défaut

[approximative translation :
Error in .prototype(...) :
  the argument "list" is missing, with no default value
]


Christophe


Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre

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


[Rd] R2.7 package.skeleton II

2008-04-13 Thread cgenolin
Hi again

I get an other error on an other file. More precisely,

package.skeleton("kmt2",code_files=c("function.r","partition.r","longData.r","imputation.r","clusterization.r"))

I put 5 files in code_files,  everything seems to work fine, the 
directory "kmt2" is created, but I get an message :

Création des répertoires...
Création de DESCRIPTION...
Création de 'Read-and-delete-me'...
Recopiage des fichiers de code...
Création des fichiers d'aide ...
Error in le > 0 :  comparaison (6) possible seulement pour les types 
liste et atomique
De plus : Warning message:
In is.na(le) :
  is.na() appliqué à un objet de type 'S4' qui n'est ni une liste, ni un vecteur
Erreur dans package.skeleton("kmt8", code_files = c("function.r", 
"partition.r",  :  Error in le > 0 :  comparaison (6) possible 
seulement pour les types liste et atomique


If someone want, I can send my complete files, but I did not manage to 
precisely find the part of the programme that provoque this error (as I 
did in my previous bug repport).

Christophe


Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre

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


Re: [Rd] R 2.7 package.skeleton

2008-04-13 Thread John Chambers
Seems to be an R bug in evaluating the source code in your file.

As the message says, something is trying to evaluate the "list" argument 
to package.skeleton.  My guess is that it's the unfortunate choice of 
"list" as an argument name interacting with your use of list() in the 
code in essai.r  (By the language semantics a function and a 
non-function with the same name _should_ be ok, but the fact that there 
is no default may be triggering a difficulty in sys.source())

To make life more difficult, package.skeleton does not seem to like a 
zero-length list= argument either.  The following is an ugly way to 
avoid the error, by creating a list with one object.

 > nul <- ""
 > package.skeleton("kmt", code_files = "essai.r", list = "nul")
Creating directories ...
Creating DESCRIPTION ...
Creating Read-and-delete-me ...
Copying code files ...
Making help files ...
Done.
Further steps are described in './kmt/Read-and-delete-me'.




[EMAIL PROTECTED] wrote:
> Hi the devel list
>
> I am testing package.skeleton in R 2.7 (download today). I get an error 
> that I do not understand. I guess it is not an error from my code since 
> I have no probleme when I source it. So is it a error in 
> package.skeleton?
>
> Here is my code :
>
>
> --- 8< -- File essai.r -
> setClass(
>Class="ClusterizLongData",
>representation=representation(
>  clusterizS="list"
>),
>prototype=prototype(
>  clusterizS=list(c2=list(),c3=list())
>)
> )
> --- 8< -
>
>
> package.skeleton("kmt",code_files=c("essai.r"))
>
> Erreur dans .prototype(...) :  l'argument "list" est manquant, avec 
> aucune valeur par défaut
>
> [approximative translation :
> Error in .prototype(...) :
>   the argument "list" is missing, with no default value
> ]
>
>
> Christophe
>
> 
> Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre
>
> __
> 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] R 2.7 package.skeleton

2008-04-13 Thread John Chambers
Well, the workaround does not help much.  The source files will be 
copied to the new package, but they are not evaluated (because 
package.skeleton requires list= to be missing).  Therefore you won't 
have the documentation files reflecting the contents of essai.r

So, for the moment, this just seems to be a bug needing fixing.  Merci 
et ne quittez pas.

John

John Chambers wrote:
> Seems to be an R bug in evaluating the source code in your file.
>
> As the message says, something is trying to evaluate the "list" argument 
> to package.skeleton.  My guess is that it's the unfortunate choice of 
> "list" as an argument name interacting with your use of list() in the 
> code in essai.r  (By the language semantics a function and a 
> non-function with the same name _should_ be ok, but the fact that there 
> is no default may be triggering a difficulty in sys.source())
>
> To make life more difficult, package.skeleton does not seem to like a 
> zero-length list= argument either.  The following is an ugly way to 
> avoid the error, by creating a list with one object.
>
>  > nul <- ""
>  > package.skeleton("kmt", code_files = "essai.r", list = "nul")
> Creating directories ...
> Creating DESCRIPTION ...
> Creating Read-and-delete-me ...
> Copying code files ...
> Making help files ...
> Done.
> Further steps are described in './kmt/Read-and-delete-me'.
>
>
>
>
> [EMAIL PROTECTED] wrote:
>   
>> Hi the devel list
>>
>> I am testing package.skeleton in R 2.7 (download today). I get an error 
>> that I do not understand. I guess it is not an error from my code since 
>> I have no probleme when I source it. So is it a error in 
>> package.skeleton?
>>
>> Here is my code :
>>
>>
>> --- 8< -- File essai.r -
>> setClass(
>>Class="ClusterizLongData",
>>representation=representation(
>>  clusterizS="list"
>>),
>>prototype=prototype(
>>  clusterizS=list(c2=list(),c3=list())
>>)
>> )
>> --- 8< -
>>
>>
>> package.skeleton("kmt",code_files=c("essai.r"))
>>
>> Erreur dans .prototype(...) :  l'argument "list" est manquant, avec 
>> aucune valeur par défaut
>>
>> [approximative translation :
>> Error in .prototype(...) :
>>   the argument "list" is missing, with no default value
>> ]
>>
>>
>> Christophe
>>
>> 
>> Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre
>>
>> __
>> 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
>
>   

[[alternative HTML version deleted]]

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


Re: [Rd] R 2.7 package.skeleton

2008-04-13 Thread John Chambers
Providing a default argument  list=character() seems to fix 
package.skeleton for this example.  Should be in the next version of R 
2.7 beta.

Regarding your other example.  This looks more like a real error in your 
code.

Error in le > 0 :  comparaison (6) possible seulement pour les types 
liste et atomique
De plus : Warning message:
In is.na(le) :
  is.na() appliqué à un objet de type 'S4' qui n'est ni une liste, ni un vecteur

These sound like legitimate error messages.  However, try this example 
with the corrected package.skeleton() as well.


John Chambers wrote:
> Well, the workaround does not help much.  The source files will be 
> copied to the new package, but they are not evaluated (because 
> package.skeleton requires list= to be missing).  Therefore you won't 
> have the documentation files reflecting the contents of essai.r
>
> So, for the moment, this just seems to be a bug needing fixing.  Merci 
> et ne quittez pas.
>
> John
>
> John Chambers wrote:
>   
>> Seems to be an R bug in evaluating the source code in your file.
>>
>> As the message says, something is trying to evaluate the "list" argument 
>> to package.skeleton.  My guess is that it's the unfortunate choice of 
>> "list" as an argument name interacting with your use of list() in the 
>> code in essai.r  (By the language semantics a function and a 
>> non-function with the same name _should_ be ok, but the fact that there 
>> is no default may be triggering a difficulty in sys.source())
>>
>> To make life more difficult, package.skeleton does not seem to like a 
>> zero-length list= argument either.  The following is an ugly way to 
>> avoid the error, by creating a list with one object.
>>
>>  > nul <- ""
>>  > package.skeleton("kmt", code_files = "essai.r", list = "nul")
>> Creating directories ...
>> Creating DESCRIPTION ...
>> Creating Read-and-delete-me ...
>> Copying code files ...
>> Making help files ...
>> Done.
>> Further steps are described in './kmt/Read-and-delete-me'.
>>
>>
>>
>>
>> [EMAIL PROTECTED] wrote:
>>   
>> 
>>> Hi the devel list
>>>
>>> I am testing package.skeleton in R 2.7 (download today). I get an error 
>>> that I do not understand. I guess it is not an error from my code since 
>>> I have no probleme when I source it. So is it a error in 
>>> package.skeleton?
>>>
>>> Here is my code :
>>>
>>>
>>> --- 8< -- File essai.r -
>>> setClass(
>>>Class="ClusterizLongData",
>>>representation=representation(
>>>  clusterizS="list"
>>>),
>>>prototype=prototype(
>>>  clusterizS=list(c2=list(),c3=list())
>>>)
>>> )
>>> --- 8< -
>>>
>>>
>>> package.skeleton("kmt",code_files=c("essai.r"))
>>>
>>> Erreur dans .prototype(...) :  l'argument "list" est manquant, avec 
>>> aucune valeur par défaut
>>>
>>> [approximative translation :
>>> Error in .prototype(...) :
>>>   the argument "list" is missing, with no default value
>>> ]
>>>
>>>
>>> Christophe
>>>
>>> 
>>> Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre
>>>
>>> __
>>> 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
>>
>>   
>> 
>
>   [[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] R 2.7 package.skeleton

2008-04-13 Thread cgenolin
> However, try this example with the corrected package.skeleton() as well.

I did, it is working

Thanks

Christophe

>
>
> John Chambers wrote:
>> Well, the workaround does not help much.  The source files will be 
>> copied to the new package, but they are not evaluated (because 
>> package.skeleton requires list= to be missing).  Therefore you won't 
>> have the documentation files reflecting the contents of essai.r
>>
>> So, for the moment, this just seems to be a bug needing fixing.  
>> Merci et ne quittez pas.
>>
>> John
>>
>> John Chambers wrote:
>>
>>> Seems to be an R bug in evaluating the source code in your file.
>>>
>>> As the message says, something is trying to evaluate the "list" 
>>> argument to package.skeleton.  My guess is that it's the 
>>> unfortunate choice of "list" as an argument name interacting with 
>>> your use of list() in the code in essai.r  (By the language 
>>> semantics a function and a non-function with the same name _should_ 
>>> be ok, but the fact that there is no default may be triggering a 
>>> difficulty in sys.source())
>>>
>>> To make life more difficult, package.skeleton does not seem to like 
>>> a zero-length list= argument either.  The following is an ugly way 
>>> to avoid the error, by creating a list with one object.
>>>
>>>  > nul <- ""
>>>  > package.skeleton("kmt", code_files = "essai.r", list = "nul")
>>> Creating directories ...
>>> Creating DESCRIPTION ...
>>> Creating Read-and-delete-me ...
>>> Copying code files ...
>>> Making help files ...
>>> Done.
>>> Further steps are described in './kmt/Read-and-delete-me'.
>>>
>>>
>>>
>>>
>>> [EMAIL PROTECTED] wrote:
>>>
 Hi the devel list

 I am testing package.skeleton in R 2.7 (download today). I get an 
 error that I do not understand. I guess it is not an error from my 
 code since I have no probleme when I source it. So is it a error 
 in package.skeleton?

 Here is my code :


 --- 8< -- File essai.r -
 setClass(
Class="ClusterizLongData",
representation=representation(
  clusterizS="list"
),
prototype=prototype(
  clusterizS=list(c2=list(),c3=list())
)
 )
 --- 8< -


 package.skeleton("kmt",code_files=c("essai.r"))

 Erreur dans .prototype(...) :  l'argument "list" est manquant, 
 avec aucune valeur par défaut

 [approximative translation :
 Error in .prototype(...) :
   the argument "list" is missing, with no default value
 ]


 Christophe

 
 Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre

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




Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre

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


Re: [Rd] Matrix multiplication in a C code

2008-04-13 Thread Mathieu Ribatet
First, sorry for the delayed reply.

You were right matprod will do exactly what I want. Thanks. On another 
point, are you aware about a BLAS routine to test for semi-definite 
positive matrix ? This is required for my loglikelihood and thus should 
return -\infty if not.

Best,
Mathieu


Prof Brian Ripley a écrit :
> On Sun, 6 Apr 2008, Mathieu Ribatet wrote:
>
>>Dear list members,
>>
>> I've got a small question on matrix multiplications in a C code. Because
>> of a really cpu demanding likelihood, I had to use a C code within an R
>> function wrapper. I'm pretty sure that there is already one good code
>> for matrix multiplication in C - maybe in the R source code itself - but
>> I wasn't able to find it.
>>
>> Anyone as an idea on how to handle matrix multiplications?
>
> Well, R does use fast C code where available: see matmult in 
> src/main/array.c which calls the BLAS.  It works best if you have an 
> optimized BLAS: otherwise it may not be as fast as the simple version 
> used when there are NAs present.
>

-- 
Institute of Mathematics
Ecole Polytechnique Fédérale de Lausanne
STAT-IMA-FSB-EPFL, Station 8
CH-1015 Lausanne   Switzerland
http://stat.epfl.ch/
Tel: + 41 (0)21 693 7907

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


[Rd] && and ||

2008-04-13 Thread Yuan Jian
Hello there,
   
  I got a small problem about logical calculation:
  we can get a sequene from a+b as below:
   
  > a<-c(1,2)
> b<-c(3,4)
> a+b
[1] 4 6
   
  but when the sequences are logical. (I want to get (True,False) && (True, 
True) ==> (True, False), but when I do as below.
> e<-c(T,T)
> f<-c(F,T)
> e
[1] TRUE TRUE
> f
[1] FALSE  TRUE
> g<-e && f
  **g becomes one logical value only
> g
[1] FALSE
> 
what should I do when I want to get a sequence for operate && or ||?
   
  kind regards
  Yu
   


[[alternative HTML version deleted]]

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


[Rd] Incorrect @INC: Rcmd SHLIB error under Windows (2.6.2, 44383) (PR#11161)

2008-04-13 Thread wolpert
Hi, R team.

I'm trying to build a dll from a c program to be invoked within R using 
the .C() functionality.

Everything works like a charm on my Linux (Centos 5) (also 2.6.2) machines--- 
but under windows (Vista Ultimate) upon running (in either the windows 'Cmd' 
command window or a Bash window) the command

Rcmd SHLIB myfun.c

I receive the error:

Can't locate R/Utils.pm in
@INC (@INC contains: c \PROGRA~1\R\R-26~1.2\share\perl;
/usr/lib/perl5/5.8/cygwin /usr/lib/perl5/5.8
/usr/lib/perl5/site_perl/5.8/cygwin /usr/lib/perl5/site_perl/5.8
/usr/lib/perl5/site_perl/5.8 /usr/lib/perl5/vendor_perl/5.8/cygwin
/usr/lib/perl5/vendor_perl/5.8 /usr/lib/perl5/vendor_perl/5.8 .) at
c:\PROGRA~1\R\R-26~1.2/bin/SHLIB line 22.
BEGIN failed--compilation aborted at c:\PROGRA~1\R\R-26~1.2/bin/SHLIB line
22.

-- -- -- -- --

Notice the first entry in @INC is incorrect---  the item

   c \PROGRA~1\R\R-26~1.2\share\perl;

SHOULD be

   c:\PROGRA~1\R\R-26~1.2\share\perl;

but a space appears where the colon should be.

The neeeded file 'R/Utils.pm' is in fact located where it should be,
below 'c:\PROGRA~1\R\R-26~1.2\share\perl', but perl can't find it because
INC is set incorrectly.

Any suggestions?  Where IS 'INC' set?  Cheers,-R

--
 Prof. Robert L. Wolpert : <[EMAIL PROTECTED]>  : +1-919-684-3275
 Duke Univ. Dept. of Statistical Science  :  211c Old Chem, Box 90251
 & Nicholas School of the Environment :   www.stat.Duke.edu/~rlw/

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


[Rd] promptFunctions() to handle multiple names

2008-04-13 Thread Daniel Sabanés Bové
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Hi all,

I wanted to set up my first (private) R-package and wondered
if there was a function to prompt() for multiple aliases in one Rd-file,
e.g. to create something like the normal distribution manual page
encompassing rnorm, dnorm,...

As I didn't find it, I modified prompt.default() and wrote a small function
to do this job, called "promptFunctions". It basically calls the helper
".promptFunction" for every name it gets and puts together the output
from each function.

It would be interesting for me if such a function already existed in R
or if something like "promptFunction" could be included in any future R 
version.
I think it would be used as many man pages document several functions at 
once,
and cutting and pasting the single prompt() files by hand could be boring.

regards,
Daniel

The Code:

## modified prompt.default to handle multiple functions correctly
promptFunctions <-
~function (...,  # objects to be documented
~  filename = NULL,  # file name string or NA for 
console
~  names = NULL, # character vector of object names
~  rdname = NULL,# name of the documentation
~  overwrite = FALSE # overwrite existing Rd file?
~  )
{
~## helper functions
~paste0 <- function(...) paste(..., sep = "")
~is.missing.arg <- function(arg) typeof(arg) == "symbol" &&
~deparse(arg) == ""

~## generate additional names from objects
~objects <- as.list (substitute (...[]))
~objects <- objects[seq(from = 2, to = length(objects) - 1)]
~objects <- sapply(objects, deparse)

~## merge with names from call and stop if there are no usable names
~names <- unique(c(objects, names))
~if (is.null(names))
~stop ("cannot determine usable names")

~## determine Rd name
~if(is.null(rdname))
~rdname <- names[1]

~## determine file name
~if (is.null(filename))
~filename <- paste0(rdname, ".Rd")

~## treat each name individually
~promptList <- lapply(names, .promptFunction)
~names(promptList) <- names

~## construct text
~Rdtxt <- list()

~Rdtxt$name <- paste0("\\name{", rdname, "}")
~Rdtxt$aliases <- c(paste0("\\alias{", names, "}"),
~   paste("%- Also NEED an '\\alias' for EACH other 
topic",
~ "documented here."))
~Rdtxt$title <- "\\title{ ~~functions to do ... ~~ }"
~Rdtxt$description <- c("\\description{",
~   paste("  ~~ A concise (1-5 lines) 
description of what",
~ "the functions"),
~   paste("", paste(names, collapse = ", "),
~ "do. ~~"),
~   "}")
~Rdtxt$usage <- c("\\usage{",
~ unlist(lapply(promptList, "[[", "usage")),
~ "}",
~ paste("%- maybe also 'usage' for other objects",
~   "documented here."))
~arguments <- unique (unlist (lapply(promptList, "[[", "arg.n")))
~Rdtxt$arguments <- if(length(arguments))
~c("\\arguments{",
~  paste0("  \\item{", arguments, "}{",
~ " ~~Describe \\code{", arguments, "} here~~ }"),
~  "}")
~Rdtxt$details <- c("\\details{",
~   paste("  ~~ If necessary, more details than the",
~ "description above ~~"),
~   "}")
~Rdtxt$value <- c("\\value{",
~ "  ~Describe the values returned",
~ "  If it is a LIST, use",
~ "  \\item{comp1 }{Description of 'comp1'}",
~ "  \\item{comp2 }{Description of 'comp2'}",
~ "  ...",
~ "}")
~Rdtxt$references <- paste("\\references{ ~put references to the",
~  "literature/web site here ~ }")
~Rdtxt$author <- "\\author{Daniel Saban\\'es Bov\\'e}"
~Rdtxt$note <- c("\\note{ ~~further notes~~ ",
~"",
~paste(" ~Make other sections like Warning with",
~  "\\section{Warning }{} ~"),
~"}")
~Rdtxt$seealso <- paste("\\seealso{ ~~objects to See Also as",
~   "\\code{\\link{help}}, ~~~ }")
~Rdtxt$examples <- c("\\examples{",
~"## Should be DIRECTLY executable !! ",
~"##-- ==>  Define data, use random,",
~"##--\tor do  help(data=index)  for the 
standard data sets.",
~"",
~"## The functions are currently defined as",
~unlist (lapply(promptList, "[[", "x.def")),
~"}")
~Rdtxt$keywords <- c(paste("% Add one or more standard keywords,",
~ 

[Rd] Bug in ci.plot(HH Package) (PR#11163)

2008-04-13 Thread nakajima
Full_Name: Yasuhiro Nakajima
Version: 2.6.1
OS: WinXP SP2
Submission from: (NULL) (202.237.255.13)


Dear all,

I noticed the following behaviour of ci.plot in HH Package(ver.2.1-9):

> library(HH)
> data(women, package="datasets")
> attach(women)
> ft <- lm(height~weight)
> windows()
> ci.plot(ft,conf.level=0.95)
> windows()
> ci.plot(ft,conf.level=0.999)

I tried to change the confidence interval, but I couldn't.
CI was "always" 0.95. 

I have found wrong argument in predict function in ci.plot.

>>   predict(., conf.level=conf.level)

I think the correct is "level=conf.level".

Is that right?


--- ci.plot source code ---
"ci.plot" <-
function(lm.object, ...)
  UseMethod("ci.plot")

"ci.plot.lm" <-
function(lm.object,
 xlim=range(data[, x.name]),
 newdata,
 conf.level=.95,
 data=model.frame(lm.object),
 newfit,
 ylim=range(newfit$pi.fit),
 pch=16,
 main.cex=1,
 main=list(paste(100*conf.level,
   "% confidence and prediction intervals for ",
   substitute(lm.object), sep=""), cex=main.cex), ...
 ) {
  formula.lm <- formula(lm.object)
  x.name <- as.character(formula.lm[[3]])
  missing.xlim <- missing(xlim)   ## R needs this
  missing.newdata <- missing(newdata) ## R needs this
  if.R(s={
## Save a copy of the data.frame in frame=0 to put it where
## model.frame.lm needs to find it when the example data is
## run through Splus CMD check.
my.data.name <- as.character(lm.object$call$data)
if (length(my.data.name)==0)
  stop("Please provide an lm.object calculated with an explicit
'data=my.data.frame' argument.")
undo.it <- (!is.na(match(my.data.name, objects(0
if (undo.it) old.contents <- get(my.data.name, frame=0)
my.data <- try(get(my.data.name))
if (class(my.data)=="Error")
  my.data <- try(get(my.data.name, frame=sys.parent()))
if (class(my.data)=="Error")
  stop("Please send me an email with a reproducible situation that got you
here. ([EMAIL PROTECTED])")
assign(my.data.name, my.data, frame=0)
  },r={})
  default.newdata <- data.frame(seq(xlim[1], xlim[2], length=51))
  names(default.newdata) <- x.name
  if (missing.xlim) xlim <- xlim + diff(xlim)*c(-.02,.02) ## needed
  if (missing.newdata) {
newdata <- default.newdata
newdata.x <- numeric()
  }
  else {
if (is.na(match(x.name, names(newdata
  stop(paste("'newdata' must be a data.frame containing a column named '",
 x.name, "'", sep=""))
if (missing.xlim)
  xlim=range(xlim, newdata[[x.name]])
newdata.x <- as.data.frame(newdata)[,x.name]
newdata <- rbind(as.data.frame(newdata)[,x.name, drop=FALSE],
 default.newdata)
newdata <- newdata[order(newdata[,x.name]), , drop=FALSE]
  }
  if (missing.xlim) xlim <- xlim + diff(xlim)*c(-.02,.02) ## repeat is needed
  if (missing(newfit)) newfit <-
if.R(s={
  
  prediction <-
predict(lm.object, newdata=newdata,
se.fit=TRUE, ci.fit=TRUE, pi.fi=TRUE,
conf.level=conf.level)
  {
## restore frame=0
if (undo.it) assign(my.data.name, old.contents, frame=0)
else remove(my.data.name, frame=0)
  }
  prediction
}
 ,r={
   new.p <-
 predict(lm.object, newdata=newdata,
 se.fit=TRUE, conf.level=conf.level,
 interval = "prediction")
   new.c <-
 predict(lm.object, newdata=newdata,
 se.fit=TRUE, conf.level=conf.level,
 interval = "confidence")
   tmp <- new.p
   tmp$ci.fit <- new.c$fit[,c("lwr","upr"), drop=FALSE]
   dimnames(tmp$ci.fit)[[2]] <- c("lower","upper")
   attr(tmp$ci.fit,"conf.level") <- conf.level
   tmp$pi.fit <- new.p$fit[,c("lwr","upr"), drop=FALSE]
   dimnames(tmp$pi.fit)[[2]] <- c("lower","upper")
   attr(tmp$pi.fit,"conf.level") <- conf.level
   tmp$fit <- tmp$fit[,"fit", drop=FALSE]
   tmp
 })
  tpgsl <- trellis.par.get("superpose.line")
  tpgsl <- Rows(tpgsl, 1:4)
  tpgsl$col[1] <- 0
  xyplot(formula.lm, data=data, newdata=newdata, newfit=newfit,
 newdata.x=newdata.x,
 xlim=xlim, ylim=ylim, pch=pch,
 panel=function(..., newdata.x) {
   panel.ci.plot(...)
   if (length(newdata.x) > 0)
 panel.rug(x=newdata.x)
 },
 main=main,
 key=list(border=TRUE,
   space="right",
   text=list(c("observed","fit","conf int","pred int")),
   points=list(
 pch=c(pch,32,32,32),
 col=c(trellis.par.get("plot.symbol")$col, tpgsl$col[2:4])
 ),
   lines=tpgsl),
 ...)
}

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