[Rd] Questions about building R extensions from C, data/ and man/, sbml file

2008-06-09 Thread Hang PHAN
Hi,

I am building the package in R using

>R CMD build -force ./mypackage

and check it using

>R CMD check ./mypackage

However I have a problem when running the examples in the manual files. The
problem is that I used a specifice type of file that is not table, thus I
guess data() can't be use to indicate the use of that particular file in the
directory data/. Do you have any idea how I can pass the name of this data
file as a string into the arguments of my function

e.g. in abc.Rd
\Examples{
ss<- abc(fname = "xxx.sbml")
}
where xxx.sbml is a file in the data/ directory.

Again, thanks very much and looking forwards to your reply.

Phan Hang

[[alternative HTML version deleted]]

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


Re: [Rd] Questions about building R extensions from C, data/ and man/, sbml file

2008-06-09 Thread Prof Brian Ripley
Use system.file().  But please don't put your files in the data directory: 
as the manual says.


  The data subdirectory is for additional data files the package makes
  available for loading using data().

So if you put your data files in inst/sbml, your example becomes

abc(fname = system.file(package="mypackage", "sbml", "xxx.sbml"))

since this will be mypackage/sbml/xxx.sbml when installed.

There are several examples on CRAN, e.g. rgdal.


On Mon, 9 Jun 2008, Hang PHAN wrote:


Hi,

I am building the package in R using


R CMD build -force ./mypackage


and check it using


R CMD check ./mypackage


However I have a problem when running the examples in the manual files. The
problem is that I used a specifice type of file that is not table, thus I
guess data() can't be use to indicate the use of that particular file in the
directory data/. Do you have any idea how I can pass the name of this data
file as a string into the arguments of my function

e.g. in abc.Rd
\Examples{
ss<- abc(fname = "xxx.sbml")
}
where xxx.sbml is a file in the data/ directory.

Again, thanks very much and looking forwards to your reply.

Phan Hang

[[alternative HTML version deleted]]

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



--
Brian D. Ripley,  [EMAIL PROTECTED]
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] Questions about building R extensions from C, data/ and man/, sbml file

2008-06-09 Thread Hang PHAN
Dear Prof. Ripley,
It worked. Thank you very much for a useful tip.

On Mon, Jun 9, 2008 at 12:56 PM, Prof Brian Ripley <[EMAIL PROTECTED]>
wrote:

> Use system.file().  But please don't put your files in the data directory:
> as the manual says.
>
>  The data subdirectory is for additional data files the package makes
>  available for loading using data().
>
> So if you put your data files in inst/sbml, your example becomes
>
> abc(fname = system.file(package="mypackage", "sbml", "xxx.sbml"))
>
> since this will be mypackage/sbml/xxx.sbml when installed.
>
> There are several examples on CRAN, e.g. rgdal.
>
>
>
> On Mon, 9 Jun 2008, Hang PHAN wrote:
>
>  Hi,
>>
>> I am building the package in R using
>>
>>  R CMD build -force ./mypackage
>>>
>>
>> and check it using
>>
>>  R CMD check ./mypackage
>>>
>>
>> However I have a problem when running the examples in the manual files.
>> The
>> problem is that I used a specifice type of file that is not table, thus I
>> guess data() can't be use to indicate the use of that particular file in
>> the
>> directory data/. Do you have any idea how I can pass the name of this data
>> file as a string into the arguments of my function
>>
>> e.g. in abc.Rd
>> \Examples{
>> ss<- abc(fname = "xxx.sbml")
>> }
>> where xxx.sbml is a file in the data/ directory.
>>
>> Again, thanks very much and looking forwards to your reply.
>>
>> Phan Hang
>>
>>[[alternative HTML version deleted]]
>>
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>>
> --
> Brian D. Ripley,  [EMAIL PROTECTED]
> 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
>



-- 
Phan Hang

[[alternative HTML version deleted]]

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


Re: [Rd] R and Gnumeric

2008-06-09 Thread Peter Dalgaard
Jean Bréfort wrote:
> One other totally unrelated thing. We got recently a bug report about an
> incorrect R squared in gnumeric regression code
> (http://bugzilla.gnome.org/show_bug.cgi?id=534659). R (version 2.7.0)
> give the same result as Gnumeric as can be seen below:
>
>   
>> mydata <- read.csv(file="data.csv",sep=",")
>> mydata
>> 
>   X  Y
> 1 1  2
> 2 2  4
> 3 3  5
> 4 4  8
> 5 5  0
> 6 6  7
> 7 7  8
> 8 8  9
> 9 9 10
>   
>> summary(lm(mydata$Y~mydata$X))
>> 
>
> Call:
> lm(formula = mydata$Y ~ mydata$X)
>
> Residuals:
> Min  1Q  Median  3Q Max 
> -5.8889  0.2444  0.5111  0.7111  2.9778 
>
> Coefficients:
> Estimate Std. Error t value Pr(>|t|)  
> (Intercept)   1.5556 1.8587   0.837   0.4303  
> mydata$X  0.8667 0.3303   2.624   0.0342 *
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
>
> Residual standard error: 2.559 on 7 degrees of freedom
> Multiple R-squared: 0.4958,   Adjusted R-squared: 0.4238 
> F-statistic: 6.885 on 1 and 7 DF,  p-value: 0.03422 
>
>   
>> summary(lm(mydata$Y~mydata$X-1))
>> 
>
> Call:
> lm(formula = mydata$Y ~ mydata$X - 1)
>
> Residuals:
> Min  1Q  Median  3Q Max 
> -5.5614  0.1018  0.3263  1.6632  3.5509 
>
> Coefficients:
>  Estimate Std. Error t value Pr(>|t|)
> mydata$X   1.1123 0.1487   7.481 7.06e-05 ***
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
>
> Residual standard error: 2.51 on 8 degrees of freedom
> Multiple R-squared: 0.8749,   Adjusted R-squared: 0.8593 
> F-statistic: 55.96 on 1 and 8 DF,  p-value: 7.056e-05 
>
> I am unable to figure out what this 0.8749 value might represent. If it
> is intended to be the Pearson moment, it should be 0.4958, and if it is
> the coefficient of determination, I think the correct value would be
> 0.4454 as given by Excel. It's of course nice to have the same result in
> R and Gnumeric,but it would be better if this result was accurate (if it
> is, we need some documentation fix). Btw, I am not a statistics expert
> at all.
>   
This horse has been flogged multiple times on the list.

It is of course mainly a matter of convention, but the convention used
by R has been around at least since Genstat in the mid-1970s. In the
no-intercept case, you get the _uncentered_ version of R-squared; that
is, the proportion of the sum of squares explained by the model (as
opposed to sum of squares of _deviations_ in the usual case.) The
rationale is that the R^2 should be based on a reduction in residual
variation between two nested models, and if theres no intercept, the
only well-determined nested model is the one where mydata$Y has mean
zero for all x corresponding to all-zero regression coefficients. The
resulting R^2 is directly related to the F statistic, which you'll see
is also larger and more significant when the intercept is removed.

BTW:  lm(mydata$Y~mydata$X) is bad practice, use lm(Y~X, data=mydata).
Use of predict() will demonstrate why.

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

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


Re: [Rd] Posting Guide - help.request() function?

2008-06-09 Thread Dr Heather Turner
Whilst it is a good idea to improve the posting guide, it seems to me 
that it would be useful to have a function along the lines of 
bug.report(), to help a potential questioner make sure they have done 
their homework and have the relevant information to put into a post to 
R-help.


Even those of us who know what ought to go into a post can sometimes 
forget to check something obvious - I recently got caught out by not 
checking an error was reproducible in the patched version for example.


So I have written a help.request() function (see below), which
- prompts the user to check the relevant resources, stopping and opening 
the relevant url where necessary
- checks their R version is up-to-date (in a rather messy way - please 
suggest improvements!)
- prompts them to prepare appropriate example code and test it in a 
fresh R session

- prompts them to give a meaningful subject line
- automatically adds system info to the post (as in bug.report)
- sends the message for them (ensuring a fresh thread is started)

Is this an idea worth taking further? I would be happy to make 
improvements as suggested and write a help file if so.


Heather



help.request <- function (subject = "",
  ccaddress = Sys.getenv("USER"),
  method = getOption("mailer"),
  address = "[EMAIL PROTECTED]",
  file = "R.help.request")
{
no <- function(answer) answer == "n"
yes <- function(answer) answer == "y"
go <- function(url) {
cat("Please do this first - the site has been loaded in your 
web browser\n")

browseURL(url)
}
cat("Checklist:\n")
post <- readline("Have you read the posting guide? (y/n) ")
if (no(post)) return(go("http://www.r-project.org/posting-guide.html";))
FAQ <- readline("Have you checked the FAQ? (y/n) ")
if (no(FAQ)) return(go("http://cran.r-project.org/faqs.html";))
intro <- readline("Have you checked An Introduction to R? (y/n) ")
if (no(intro)) 
return(go("http://cran.r-project.org/doc/manuals/R-intro.html";))
NEWS <- readline("Have you checked the NEWS of the latest 
development release? (y/n) ")

if (no(NEWS)) return(go("https://svn.r-project.org/R/trunk/NEWS";))
rsitesearch <- readline("Have you looked on RSiteSearch? (y/n) ")
if (no(rsitesearch)) {
cat("Please do this first - the site has been loaded in your 
web browser\n")

return(RSiteSearch(subject))
}
inf <- sessionInfo()
if ("otherPkgs" %in% names(inf)){
other <- readline("You have packages other than the base 
packages loaded.",
  "\nIf your query relates to one of these, 
have you ",

  "checked any corresponding books/manuals \nand ",
  "considered contacting the package 
maintainer? (y/n/NA) ")

if(no(other)) return("Please do this first.")
}

man <- url("http://cran.r-project.org/manuals.html";)
ver <- scan(man, what = character(0), sep = "\n", skip = 13, nlines 
= 1, quiet = TRUE)

major <- as.numeric(substr(ver, start = 18, stop = 18))
minor <- as.numeric(substr(ver, start = 20, stop = 22))
if (major < as.numeric(R.Version()$major) ||
minor < as.numeric(R.Version()$major)) {
update <- readline("Your R version is out-of-date, would you 
like to update now? (y/n) ")

if (yes(update)) {
return(go(getOption("repos")))
}
}
## To get long prompt!
cat("Have you written example code that is\n",
"- minimal\n - reproducible\n - self-contained\n - commented",
"\nusing data that is either\n",
"- constructed by the code\n - loaded by data()\n",
"- reproduced using dump(\"mydata\", file = \"\")\n")
code <- readline(paste("have you checked this code in a fresh R 
session",
   "\n(invoking R with the --vanilla option if 
possible)",
   "\nand is this code copied to the clipboard? 
(y/n) "))

if (no(code))
return(cat("\nIf your query is not directly related to code",
   "(e.g. a general query \nabout R's capabilities),",
   "email [EMAIL PROTECTED] directly. ",
   "\nOtherwise prepare some example code first.\n"))
change <- readline(paste("Would you like to change your subject 
line:\n",
 subject, "\nto something more meaningful? 
(y/n) "))

if (yes(change))
subject <- readline("Enter subject: \n")

methods <- c("mailx", "gnudoit", "none", "ess")
method <- if (is.null(method))
"none"
else methods[pmatch(method, methods)]
body <- paste("\\n>",

  "\\n<>\\n\\n\\n\\n",
  "--please do not edit the information below--\\n\\n",
  "Version:\\n ", paste(names(R.version), R.version, 
sep = 

Re: [Rd] Posting Guide - help.request() function?

2008-06-09 Thread Gabor Grothendieck
That's an excellent idea.

One other item that could be checkable would
be if the user has the most recent versions of the packages involved
in the query.Perhaps it could display the unupdated packages
and ask the user if any of those are involved in the query.

Probably needs to give fair warning that it is sending
off an email so people don't wind up sending out emails when they
are really just trying out the system.  Probably "none" should be the
default for email so that its not regarded as obnoxious.

Might be nice if it used local versions of documents if they exist
locally.  On Windows they do.

Check out ?getRversion

On Mon, Jun 9, 2008 at 10:35 AM, Dr Heather Turner
<[EMAIL PROTECTED]> wrote:
> Whilst it is a good idea to improve the posting guide, it seems to me that
> it would be useful to have a function along the lines of bug.report(), to
> help a potential questioner make sure they have done their homework and have
> the relevant information to put into a post to R-help.
>
> Even those of us who know what ought to go into a post can sometimes forget
> to check something obvious - I recently got caught out by not checking an
> error was reproducible in the patched version for example.
>
> So I have written a help.request() function (see below), which
> - prompts the user to check the relevant resources, stopping and opening the
> relevant url where necessary
> - checks their R version is up-to-date (in a rather messy way - please
> suggest improvements!)
> - prompts them to prepare appropriate example code and test it in a fresh R
> session
> - prompts them to give a meaningful subject line
> - automatically adds system info to the post (as in bug.report)
> - sends the message for them (ensuring a fresh thread is started)
>
> Is this an idea worth taking further? I would be happy to make improvements
> as suggested and write a help file if so.
>
> Heather
>
> 
>
> help.request <- function (subject = "",
>  ccaddress = Sys.getenv("USER"),
>  method = getOption("mailer"),
>  address = "[EMAIL PROTECTED]",
>  file = "R.help.request")
> {
>no <- function(answer) answer == "n"
>yes <- function(answer) answer == "y"
>go <- function(url) {
>cat("Please do this first - the site has been loaded in your web
> browser\n")
>browseURL(url)
>}
>cat("Checklist:\n")
>post <- readline("Have you read the posting guide? (y/n) ")
>if (no(post)) return(go("http://www.r-project.org/posting-guide.html";))
>FAQ <- readline("Have you checked the FAQ? (y/n) ")
>if (no(FAQ)) return(go("http://cran.r-project.org/faqs.html";))
>intro <- readline("Have you checked An Introduction to R? (y/n) ")
>if (no(intro))
> return(go("http://cran.r-project.org/doc/manuals/R-intro.html";))
>NEWS <- readline("Have you checked the NEWS of the latest development
> release? (y/n) ")
>if (no(NEWS)) return(go("https://svn.r-project.org/R/trunk/NEWS";))
>rsitesearch <- readline("Have you looked on RSiteSearch? (y/n) ")
>if (no(rsitesearch)) {
>cat("Please do this first - the site has been loaded in your web
> browser\n")
>return(RSiteSearch(subject))
>}
>inf <- sessionInfo()
>if ("otherPkgs" %in% names(inf)){
>other <- readline("You have packages other than the base packages
> loaded.",
>  "\nIf your query relates to one of these, have you
> ",
>  "checked any corresponding books/manuals \nand ",
>  "considered contacting the package maintainer?
> (y/n/NA) ")
>if(no(other)) return("Please do this first.")
>}
>
>man <- url("http://cran.r-project.org/manuals.html";)
>ver <- scan(man, what = character(0), sep = "\n", skip = 13, nlines = 1,
> quiet = TRUE)
>major <- as.numeric(substr(ver, start = 18, stop = 18))
>minor <- as.numeric(substr(ver, start = 20, stop = 22))
>if (major < as.numeric(R.Version()$major) ||
>minor < as.numeric(R.Version()$major)) {
>update <- readline("Your R version is out-of-date, would you like to
> update now? (y/n) ")
>if (yes(update)) {
>return(go(getOption("repos")))
>}
>}
>## To get long prompt!
>cat("Have you written example code that is\n",
>"- minimal\n - reproducible\n - self-contained\n - commented",
>"\nusing data that is either\n",
>"- constructed by the code\n - loaded by data()\n",
>"- reproduced using dump(\"mydata\", file = \"\")\n")
>code <- readline(paste("have you checked this code in a fresh R session",
>   "\n(invoking R with the --vanilla option if
> possible)",
>   "\nand is this code copied to the clipboard? (y/n)
> "))
>if (no(code))
>return(cat("\nIf your query is not directly

Re: [Rd] Posting Guide - help.request() function?

2008-06-09 Thread Dr Heather Turner
Thanks for the helpful tips and suggestions, I'll work them in. You get 
local versions of the documents on Unix too - RShowDoc() will do the trick.


I'll post an updated version in due course,

Heather


Gabor Grothendieck wrote:

That's an excellent idea.

One other item that could be checkable would
be if the user has the most recent versions of the packages involved
in the query.Perhaps it could display the unupdated packages
and ask the user if any of those are involved in the query.

Probably needs to give fair warning that it is sending
off an email so people don't wind up sending out emails when they
are really just trying out the system.  Probably "none" should be the
default for email so that its not regarded as obnoxious.

Might be nice if it used local versions of documents if they exist
locally.  On Windows they do.

Check out ?getRversion

On Mon, Jun 9, 2008 at 10:35 AM, Dr Heather Turner
<[EMAIL PROTECTED]> wrote:

Whilst it is a good idea to improve the posting guide, it seems to me that
it would be useful to have a function along the lines of bug.report(), to
help a potential questioner make sure they have done their homework and have
the relevant information to put into a post to R-help.

Even those of us who know what ought to go into a post can sometimes forget
to check something obvious - I recently got caught out by not checking an
error was reproducible in the patched version for example.

So I have written a help.request() function (see below), which
- prompts the user to check the relevant resources, stopping and opening the
relevant url where necessary
- checks their R version is up-to-date (in a rather messy way - please
suggest improvements!)
- prompts them to prepare appropriate example code and test it in a fresh R
session
- prompts them to give a meaningful subject line
- automatically adds system info to the post (as in bug.report)
- sends the message for them (ensuring a fresh thread is started)

Is this an idea worth taking further? I would be happy to make improvements
as suggested and write a help file if so.

Heather



help.request <- function (subject = "",
 ccaddress = Sys.getenv("USER"),
 method = getOption("mailer"),
 address = "[EMAIL PROTECTED]",
 file = "R.help.request")
{
   no <- function(answer) answer == "n"
   yes <- function(answer) answer == "y"
   go <- function(url) {
   cat("Please do this first - the site has been loaded in your web
browser\n")
   browseURL(url)
   }
   cat("Checklist:\n")
   post <- readline("Have you read the posting guide? (y/n) ")
   if (no(post)) return(go("http://www.r-project.org/posting-guide.html";))
   FAQ <- readline("Have you checked the FAQ? (y/n) ")
   if (no(FAQ)) return(go("http://cran.r-project.org/faqs.html";))
   intro <- readline("Have you checked An Introduction to R? (y/n) ")
   if (no(intro))
return(go("http://cran.r-project.org/doc/manuals/R-intro.html";))
   NEWS <- readline("Have you checked the NEWS of the latest development
release? (y/n) ")
   if (no(NEWS)) return(go("https://svn.r-project.org/R/trunk/NEWS";))
   rsitesearch <- readline("Have you looked on RSiteSearch? (y/n) ")
   if (no(rsitesearch)) {
   cat("Please do this first - the site has been loaded in your web
browser\n")
   return(RSiteSearch(subject))
   }
   inf <- sessionInfo()
   if ("otherPkgs" %in% names(inf)){
   other <- readline("You have packages other than the base packages
loaded.",
 "\nIf your query relates to one of these, have you
",
 "checked any corresponding books/manuals \nand ",
 "considered contacting the package maintainer?
(y/n/NA) ")
   if(no(other)) return("Please do this first.")
   }

   man <- url("http://cran.r-project.org/manuals.html";)
   ver <- scan(man, what = character(0), sep = "\n", skip = 13, nlines = 1,
quiet = TRUE)
   major <- as.numeric(substr(ver, start = 18, stop = 18))
   minor <- as.numeric(substr(ver, start = 20, stop = 22))
   if (major < as.numeric(R.Version()$major) ||
   minor < as.numeric(R.Version()$major)) {
   update <- readline("Your R version is out-of-date, would you like to
update now? (y/n) ")
   if (yes(update)) {
   return(go(getOption("repos")))
   }
   }
   ## To get long prompt!
   cat("Have you written example code that is\n",
   "- minimal\n - reproducible\n - self-contained\n - commented",
   "\nusing data that is either\n",
   "- constructed by the code\n - loaded by data()\n",
   "- reproduced using dump(\"mydata\", file = \"\")\n")
   code <- readline(paste("have you checked this code in a fresh R session",
  "\n(invoking R with the --vanilla option if
possible)",
  "\nand is this code copied to the clipboard? (y/n)
"))
   if (no(code))

Re: [Rd] Makevars or congiure for multi platforms

2008-06-09 Thread Tadashi Kadowaki
Prof Ripley,

I fixed and uploaded.

However, it is still useful for development of a package that is close
to R core,
if Rconfig.h contains all definitions in config.h. If Rconfig
contained all information,
I didn't have to refer the private header directory.

Regards,

Tadashi Kadowaki

2008/6/9 Prof Brian Ripley <[EMAIL PROTECTED]>:
> Private headers are just that, private.  They are not intended to be
> available to packages, and not installed by the standard R makefiles on
> either Unix-alikes or Windows.
>
> I don't see it documented that they are available on MacOS X, and will leave
> it to that platform's maintainers as to why they have been installed on that
> platform.
>
> You need to rewrite your code to use only documented headers and entry
> points if you intend to distribute it.
>
>
> On Mon, 9 Jun 2008, Tadashi Kadowaki wrote:
>
>> Hi, Laurent and Tobias
>>
>> Thanks a lot.
>>
>> I could make configure script and upload it to r-forge.
>> https://r-forge.r-project.org/projects/pdf2/
>> It still works only on mac by default.
>> For Linux and Windows, it needs additional option like
>> -
>> R CMD INSTALL
>> --configure-vars="R_INTERNAL_HEADER_DIR=/path/to/src/include"
>> pdf2/pkg
>> -
>> ,where /path/to/src/include is the directory in the R source.
>> I didn't check it for Linux and Windows...
>>
>> Regards,
>>
>> Tadashi Kadowaki
>>
>> 2008/6/8 Laurent Gautier <[EMAIL PROTECTED]>:
>>>
>>> 2008/6/7  <[EMAIL PROTECTED]>:

 Message: 11
 Date: Sat, 7 Jun 2008 03:38:23 +0900
 From: "Tadashi Kadowaki" <[EMAIL PROTECTED]>
 Subject: [Rd] Makevars or congiure for multi platforms
 To: r-devel@r-project.org
 Message-ID:
   <[EMAIL PROTECTED]>
 Content-Type: text/plain; charset=ISO-8859-1

 Dear all,

 As previously submitted, I wrote an extending pdf device to embed
 pop up text and web links.
 (Patches are available at http://pdf2.r-forge.r-project.org/patches)

 Now, I'm making a library version of the pdf device.
 However, with my skill, I'm not sure about writing Makevars or configure
 file
 for multi platforms. A following line in Makevars works on my mac,
 -
 PKG_CFLAGS=-I/Library/Frameworks/R.framework/PrivateHeaders
 -DHAVE_CONFIG_H
 -
 (Note that the PrivateHeaders directory contains Fileio.h and Defn.h)

 My question is,
 How do I write Makevars or congiure for Unix/Linux and Windows?
 I would like to support those platforms in my library.
>>>
>>> You could try looking into a package that has configure, configure.win
>>> and has built binaries for macosX and windows. Try the package 'rgl'
>>> on CRAN, for example.
>>>
>>>
>>> Hoping this helps,
>>>
>>>
>>> L.
>>>
>>>
>>>
 Regards,

 Tadashi Kadowaki



>>>
>>
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>
> --
> Brian D. Ripley,  [EMAIL PROTECTED]
> 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] Makevars or congiure for multi platforms

2008-06-09 Thread Prof Brian Ripley

On Tue, 10 Jun 2008, Tadashi Kadowaki wrote:


Prof Ripley,

I fixed and uploaded.

However, it is still useful for development of a package that is close
to R core,
if Rconfig.h contains all definitions in config.h. If Rconfig
contained all information,
I didn't have to refer the private header directory.


But your package can run its own configure to find such things itself. 
Which entries were you wanting to use?




Regards,

Tadashi Kadowaki

2008/6/9 Prof Brian Ripley <[EMAIL PROTECTED]>:

Private headers are just that, private.  They are not intended to be
available to packages, and not installed by the standard R makefiles on
either Unix-alikes or Windows.

I don't see it documented that they are available on MacOS X, and will leave
it to that platform's maintainers as to why they have been installed on that
platform.

You need to rewrite your code to use only documented headers and entry
points if you intend to distribute it.


On Mon, 9 Jun 2008, Tadashi Kadowaki wrote:


Hi, Laurent and Tobias

Thanks a lot.

I could make configure script and upload it to r-forge.
https://r-forge.r-project.org/projects/pdf2/
It still works only on mac by default.
For Linux and Windows, it needs additional option like
-
R CMD INSTALL
--configure-vars="R_INTERNAL_HEADER_DIR=/path/to/src/include"
pdf2/pkg
-
,where /path/to/src/include is the directory in the R source.
I didn't check it for Linux and Windows...

Regards,

Tadashi Kadowaki

2008/6/8 Laurent Gautier <[EMAIL PROTECTED]>:


2008/6/7  <[EMAIL PROTECTED]>:


Message: 11
Date: Sat, 7 Jun 2008 03:38:23 +0900
From: "Tadashi Kadowaki" <[EMAIL PROTECTED]>
Subject: [Rd] Makevars or congiure for multi platforms
To: r-devel@r-project.org
Message-ID:
  <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1

Dear all,

As previously submitted, I wrote an extending pdf device to embed
pop up text and web links.
(Patches are available at http://pdf2.r-forge.r-project.org/patches)

Now, I'm making a library version of the pdf device.
However, with my skill, I'm not sure about writing Makevars or configure
file
for multi platforms. A following line in Makevars works on my mac,
-
PKG_CFLAGS=-I/Library/Frameworks/R.framework/PrivateHeaders
-DHAVE_CONFIG_H
-
(Note that the PrivateHeaders directory contains Fileio.h and Defn.h)

My question is,
How do I write Makevars or congiure for Unix/Linux and Windows?
I would like to support those platforms in my library.


You could try looking into a package that has configure, configure.win
and has built binaries for macosX and windows. Try the package 'rgl'
on CRAN, for example.


Hoping this helps,


L.




Regards,

Tadashi Kadowaki







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



--
Brian D. Ripley,  [EMAIL PROTECTED]
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





--
Brian D. Ripley,  [EMAIL PROTECTED]
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] R CMD CHECK WARNING inappropriate for S4 method?

2008-06-09 Thread John Chambers
This one is subtle, and has mostly to do with namespace and imports, 
only secondarily to do with methods.  Bear with a fairly long story.


The description below is for a simple package P1 that imitates the 
pattern of imports in GSEABase.


First, what's generating the warning?  The function undoc() in the tools 
package looks for all the methods defined in the current package, for 
"union" in this case.  In r-devel, that uses the function findMethods().


What it gets is:
> names(findMethods("union", where = 2))
[1] "ANY#ANY" "graph#graph" "testClass#testClass"

(where "testClass" is the new class that P1 is adding.)

What it "normally" gets in these circumstances is:
> names(findMethods("union", where = 2))
[1] "testClass#testClass"

In the first case, undoc() naturally assumes you created all the methods 
and wants you to document them.


The question, then, is why are you getting the extra methods?

The answer, to the extent I understand it, is that P1 (and GSEABase) 
used the

 Imports:graph
directive in the DESCRIPTION file, instead of explicitly doing the 
import() commands in the NAMESPACE file.  Just what this does 
differently  I'm not sure, but the effect is that the generic version of 
union() in the "graph" package is no longer in the imports environment 
for package P1:


> n1 = asNamespace("P1")
> objects(parent.env(n1), all=TRUE, pattern="union")
character(0)

The result is that P1 owns the union() generic and all its methods.  In 
particular, a generic function "union" is created in P1.


The alternative way to specify the imports is to use the NAMESPACE file, 
say with:


import(graph)

Package "graph" must be added to the Depends: line of the DESCRIPTION 
file, instead of being in the Imports: line.  (Otherwise, you still get 
the new generic, owning all the methods.)


Now the generic version of union() is in the imports environment for P1; 
the setMethod() call in P1 does not create a new generic.  We can see 
this by:

> n1 = asNamespace("P1")
> objects(parent.env(n1), all=TRUE, pattern="union")
[1] ".__M__union:base" ".__T__union:base" "union"  



One final catch: In this version, you do need to ensure that the user's 
call to union() sees the generic version at run time, and not the 
nongeneric version in base.  Either require(graph) or, in P1's NAMESPACE:


export(union)

Perhaps needless to say, this is all a bit more subtle than one would like.

John





Martin Morgan wrote:

The package 'graph' defines classes graph and graphNEL (extending
graph) and a union,graph,graph-method. These are all exported and
fully documented.

The package 'GSEABase' Imports: graph and importClassesFrom(graph,
graphNEL). GSEABase defines methods on union for its own classes (not
graph / graphNEL), and has exportMethods(union).
union,graph,graph-method is not used in GSEABase.

R version 2.8.0 Under development (unstable) (2008-06-08 r45879)
reports from R CMD CHECK GSEABase

* checking for missing documentation entries ... WARNING
Undocumented S4 methods:
  generic 'union' and siglist 'graph,graph'

I guess union,graph,graph-method is exposed to the user indirectly by
its import along with the graph class and export along with the
newly-defined union methods.

It would seem inappropriate to document union,graph,graph-method in
GSEABase. Making GSEABase Depend: graph rather than Import: graph does
not help.

Any guidance welcome.

Thanks,

Martin



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


[Rd] error with R 2.7.0 (PR#11609)

2008-06-09 Thread usickim
Full_Name: Usic Kim
Version: 2.7.0.
OS: Windows XP, Windows Vista Home ed.
Submission from: (NULL) (203.255.173.162)


I installed R 2.7.0 in my PC with Windows XP Professional (in the Korean
language), and tried to start it by double-clicking the icon. I could see a wide
rectangle appearing but soon faced an error message saying Rgui.exe has kind of
"exception", or Rgui front-end has some problem. I also tried this with other PC
with Windows Vista Home edition (also in the Korean language). I tried the same
with "R 2.7.0 patched", and got the same problem. I had no problem with earlier
versions of R.

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


Re: [Rd] R CMD CHECK WARNING inappropriate for S4 method?

2008-06-09 Thread Martin Morgan
Thank you for the assistance.

I moved graph from Imports to Depends (arguably appropriate anyway, as
the reason for graph is that GSEABase defines setAs(..., "graphNEL"))
added importFrom(graph, union) to NAMESPACE, and removed
setGeneric("union", ...) in GSEABase; union was already being exported
from GSEABase.

For information, this has the consequence of invalidating what I
thought was 'careful' code invoking GSEABase::union(), since the union
I want is now graph::union (moderately inexplicable to users who
though they were dealing with gene sets and not graphs; and different
from GSEABase::intersect, which graph does not provide a generic
for). Mostly the user will never know, as unqualified 'union' or
'intersect' work appropriately.

Thanks again

Martin

John Chambers <[EMAIL PROTECTED]> writes:

> This one is subtle, and has mostly to do with namespace and imports,
> only secondarily to do with methods.  Bear with a fairly long story.
>
> The description below is for a simple package P1 that imitates the
> pattern of imports in GSEABase.
>
> First, what's generating the warning?  The function undoc() in the
> tools package looks for all the methods defined in the current
> package, for "union" in this case.  In r-devel, that uses the function
> findMethods().
>
> What it gets is:
>  > names(findMethods("union", where = 2))
> [1] "ANY#ANY" "graph#graph" "testClass#testClass"
>
> (where "testClass" is the new class that P1 is adding.)
>
> What it "normally" gets in these circumstances is:
>  > names(findMethods("union", where = 2))
> [1] "testClass#testClass"
>
> In the first case, undoc() naturally assumes you created all the
> methods and wants you to document them.
>
> The question, then, is why are you getting the extra methods?
>
> The answer, to the extent I understand it, is that P1 (and GSEABase)
> used the
>   Imports:graph
> directive in the DESCRIPTION file, instead of explicitly doing the
> import() commands in the NAMESPACE file.  Just what this does
> differently  I'm not sure, but the effect is that the generic version
> of union() in the "graph" package is no longer in the imports
> environment for package P1:
>
>  > n1 = asNamespace("P1")
>  > objects(parent.env(n1), all=TRUE, pattern="union")
> character(0)
>
> The result is that P1 owns the union() generic and all its methods.
> In particular, a generic function "union" is created in P1.
>
> The alternative way to specify the imports is to use the NAMESPACE
> file, say with:
>
> import(graph)
>
> Package "graph" must be added to the Depends: line of the DESCRIPTION
> file, instead of being in the Imports: line.  (Otherwise, you still
> get the new generic, owning all the methods.)
>
> Now the generic version of union() is in the imports environment for
> P1; the setMethod() call in P1 does not create a new generic.  We can
> see this by:
>  > n1 = asNamespace("P1")
>  > objects(parent.env(n1), all=TRUE, pattern="union")
> [1] ".__M__union:base" ".__T__union:base" "union"  
>
>
> One final catch: In this version, you do need to ensure that the
> user's call to union() sees the generic version at run time, and not
> the nongeneric version in base.  Either require(graph) or, in P1's
> NAMESPACE:
>
> export(union)
>
> Perhaps needless to say, this is all a bit more subtle than one would like.
>
> John
>
>
>
>
>
> Martin Morgan wrote:
>> The package 'graph' defines classes graph and graphNEL (extending
>> graph) and a union,graph,graph-method. These are all exported and
>> fully documented.
>>
>> The package 'GSEABase' Imports: graph and importClassesFrom(graph,
>> graphNEL). GSEABase defines methods on union for its own classes (not
>> graph / graphNEL), and has exportMethods(union).
>> union,graph,graph-method is not used in GSEABase.
>>
>> R version 2.8.0 Under development (unstable) (2008-06-08 r45879)
>> reports from R CMD CHECK GSEABase
>>
>> * checking for missing documentation entries ... WARNING
>> Undocumented S4 methods:
>>   generic 'union' and siglist 'graph,graph'
>>
>> I guess union,graph,graph-method is exposed to the user indirectly by
>> its import along with the graph class and export along with the
>> newly-defined union methods.
>>
>> It would seem inappropriate to document union,graph,graph-method in
>> GSEABase. Making GSEABase Depend: graph rather than Import: graph does
>> not help.
>>
>> Any guidance welcome.
>>
>> Thanks,
>>
>> Martin
>>   

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

Location: Arnold Building M2 B169
Phone: (206) 667-2793

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


Re: [Rd] Posting Guide - help.request() function?

2008-06-09 Thread Martin Maechler
> "HT" == Heather Turner <[EMAIL PROTECTED]>
> on Mon, 09 Jun 2008 17:21:17 +0100 writes:

HT> Thanks for the helpful tips and suggestions, I'll work
HT> them in. You get local versions of the documents on Unix
HT> too - RShowDoc() will do the trick.

HT> I'll post an updated version in due course,

Thank you, Heather and Gabor (and the other contributors).
Indeed, I too like the idea of providing a new R function for
this.
Ideally, Heather, you'd try to "factor out" some of the common
functionality of bug.report() and help.request() into a few
utils-namespace hidden auxiliary functions.

Ideally, you'd attach text/plain attachments (base64 encoded) so
there won't be line wrap arounds.

Martin



HT> Gabor Grothendieck wrote:
>> That's an excellent idea.
>> 
>> One other item that could be checkable would be if the
>> user has the most recent versions of the packages
>> involved in the query.  Perhaps it could display the
>> unupdated packages and ask the user if any of those are
>> involved in the query.
>> 
>> Probably needs to give fair warning that it is sending
>> off an email so people don't wind up sending out emails
>> when they are really just trying out the system.
>> Probably "none" should be the default for email so that
>> its not regarded as obnoxious.
>> 
>> Might be nice if it used local versions of documents if
>> they exist locally.  On Windows they do.
>> 
>> Check out ?getRversion
>> 
>> On Mon, Jun 9, 2008 at 10:35 AM, Dr Heather Turner
>> <[EMAIL PROTECTED]> wrote:
>>> Whilst it is a good idea to improve the posting guide,
>>> it seems to me that it would be useful to have a
>>> function along the lines of bug.report(), to help a
>>> potential questioner make sure they have done their
>>> homework and have the relevant information to put into a
>>> post to R-help.
>>> 
>>> Even those of us who know what ought to go into a post
>>> can sometimes forget to check something obvious - I
>>> recently got caught out by not checking an error was
>>> reproducible in the patched version for example.
>>> 
>>> So I have written a help.request() function (see below),
>>> which - prompts the user to check the relevant
>>> resources, stopping and opening the relevant url where
>>> necessary - checks their R version is up-to-date (in a
>>> rather messy way - please suggest improvements!)  -
>>> prompts them to prepare appropriate example code and
>>> test it in a fresh R session - prompts them to give a
>>> meaningful subject line - automatically adds system info
>>> to the post (as in bug.report) - sends the message for
>>> them (ensuring a fresh thread is started)
>>> 
>>> Is this an idea worth taking further? I would be happy
>>> to make improvements as suggested and write a help file
>>> if so.
>>> 
>>> Heather
>>> 
>>> 
>>> 
>>> help.request <- function (subject = "", ccaddress =
>>> Sys.getenv("USER"), method = getOption("mailer"),
>>> address = "[EMAIL PROTECTED]", file =
>>> "R.help.request") { no <- function(answer) answer == "n"
>>> yes <- function(answer) answer == "y" go <-
>>> function(url) { cat("Please do this first - the site has
>>> been loaded in your web browser\n") browseURL(url) }
>>> cat("Checklist:\n") post <- readline("Have you read the
>>> posting guide? (y/n) ") if (no(post))
>>> return(go("http://www.r-project.org/posting-guide.html";))
>>> FAQ <- readline("Have you checked the FAQ? (y/n) ") if
>>> (no(FAQ))
>>> return(go("http://cran.r-project.org/faqs.html";)) intro
>>> <- readline("Have you checked An Introduction to R?
>>> (y/n) ") if (no(intro))
>>> return(go("http://cran.r-project.org/doc/manuals/R-intro.html";))
>>> NEWS <- readline("Have you checked the NEWS of the
>>> latest development release? (y/n) ") if (no(NEWS))
>>> return(go("https://svn.r-project.org/R/trunk/NEWS";))
>>> rsitesearch <- readline("Have you looked on RSiteSearch?
>>> (y/n) ") if (no(rsitesearch)) { cat("Please do this
>>> first - the site has been loaded in your web browser\n")
>>> return(RSiteSearch(subject)) } inf <- sessionInfo() if
>>> ("otherPkgs" %in% names(inf)){ other <- readline("You
>>> have packages other than the base packages loaded.",
>>> "\nIf your query relates to one of these, have you ",
>>> "checked any corresponding books/manuals \nand ",
>>> "considered contacting the package maintainer?  (y/n/NA)
>>> ") if(no(other)) return("Please do this first.")  }
>>> 
>>> man <- url("http://cran.r-project.org/manuals.html";) ver
>>> <- scan(man, what = character(0), sep = "\n", skip = 13,
>>> nlines = 1, quiet = TRUE) major <-
>>> as.numeric(substr(ver, st

[Rd] Error in "getClass" when calling the function "show"

2008-06-09 Thread Laurent Gautier
Dear List,

Calling "show" on an object of class "summary.lm" gives:
Error in getClass(class(object)) : "summary.lm" is not a defined class

Is this a miss on my end ?


> x <- seq(1, 10)
> show(x)
 [1]  1  2  3  4  5  6  7  8  9 10
> y <- runif(10)
> fit <- lm(y ~ x)
> show(fit)

Call:
lm(formula = y ~ x)

Coefficients:
(Intercept)x
1.04938 -0.08869

> show(summary(fit))
Error in getClass(class(object)) : "summary.lm" is not a defined class
> class(summary(fit))
[1] "summary.lm"
> class((fit))
[1] "lm"
> getClass("lm")
Virtual Class

No Slots, prototype of class "S4"

Extends: "oldClass"

Known Subclasses:
Class "mlm", directly
Class "aov", directly
Class "glm", directly
Class "maov", by class "mlm", distance 2
Class "glm.null", by class "glm", distance 2
> getClass("summary.lm")
Error in getClass("summary.lm") : "summary.lm" is not a defined class
>
> sessionInfo()
R version 2.7.0 Patched (2008-06-07 r45877)
i686-pc-linux-gnu

locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base


Laurent

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


Re: [Rd] Error in "getClass" when calling the function "show"

2008-06-09 Thread Prof Brian Ripley

showDefault has

clDef <- getClass(class(object))

Looks like the showDefault code intended

clDef <- getClass(class(object), .force=TRUE)

However, why are you calling show() on a non-S4 object?  I cannot see any 
advtanges in doing so.


On Tue, 10 Jun 2008, Laurent Gautier wrote:


Dear List,

Calling "show" on an object of class "summary.lm" gives:
Error in getClass(class(object)) : "summary.lm" is not a defined class

Is this a miss on my end ?



x <- seq(1, 10)
show(x)

[1]  1  2  3  4  5  6  7  8  9 10

y <- runif(10)
fit <- lm(y ~ x)
show(fit)


Call:
lm(formula = y ~ x)

Coefficients:
(Intercept)x
   1.04938 -0.08869


show(summary(fit))

Error in getClass(class(object)) : "summary.lm" is not a defined class

class(summary(fit))

[1] "summary.lm"

class((fit))

[1] "lm"

getClass("lm")

Virtual Class

No Slots, prototype of class "S4"

Extends: "oldClass"

Known Subclasses:
Class "mlm", directly
Class "aov", directly
Class "glm", directly
Class "maov", by class "mlm", distance 2
Class "glm.null", by class "glm", distance 2

getClass("summary.lm")

Error in getClass("summary.lm") : "summary.lm" is not a defined class


sessionInfo()

R version 2.7.0 Patched (2008-06-07 r45877)
i686-pc-linux-gnu

locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base


Laurent

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



--
Brian D. Ripley,  [EMAIL PROTECTED]
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