Re: [Rd] .Rbuildignore {was: ... upgrading an R (WINDOWS) installation..}

2005-07-06 Thread Torsten Hothorn

> >
> > No!  {We have been here before, and I had explained before that}
> > this is really undesired:  ".Rbuildignore" should contain what is
> > ignored by build, but not by "check".
> > It does make sense to have extra code and / or checks for 'R CMD check'
> > that I as package developer want to run, but that are
> >  -- too time consuming
> >  -- too platform specific
> >  -- ..
> > to be run during the daily checks on CRAN (e.g.) /
> > to be run by others at all.
> >
> > {And BTW, AFAIK,  'Rcmd' is now `somewhat deprecated' in favor
> >  of "R CMD" since the latter is portable }
> >
> > --
> > Martin
> >
>
>
> I think its too heavy handed an approach. This should be up to the package
> developer via a switch.

I usually have something like

.onLoad <- function(lib, pkg) {
...
GCtorture <<- TRUE
...
return(TRUE)
}

in packages and simply

gctorture(on = GCtorture)

in all regression tests which allows me to switch between time consuming
tests and ordinary regression tests easily.

Torsten

> I like to put partially written code and other things
> not intended for distribution in .Rbuildignore and don't want them checked or
> installed until I move them out of .Rbuildignore.  That makes it
> possible to keep
> everything together.  Without this one must 1. keep them elsewhere
> (which I am considering as an alternate approach to what I do now although
> it would be a shame) or else 2. write batch files (which I have
> written for XP) to do
> a prebuild every time one does a check or install.
>
> One annoying aspect of R CMD is the requirement for capitalization.  Maybe
> that's ok on UNIX but on Windows one is used to using upper and lower
> case interchangeably.  Its also annoying to have to write two words instead of
> one for a frequently issued command.   At any rate I always call it through
> my Rcmd.bat batch file so its not really an issue for me.
>
> __
> 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] Buglet in src/appl/splines.c (PR#8030)

2005-07-25 Thread Torsten Hothorn

On Mon, 25 Jul 2005 [EMAIL PROTECTED] wrote:

>
> > "BeT" == Berwin A Turlach <[EMAIL PROTECTED]>
> > on Sun, 24 Jul 2005 16:24:51 +0200 (CEST) writes:
>
> BeT> I was looking at "splinefun" and the underlying C code
> BeT> and believe that there is a memory access error in the
> BeT> C routine "spline_eval".
>
> ...
> ...
>
> Excellent, Berwin!
>
> Specifically the part about why the bug never really triggers
> wrong behavior.
> Your mail should be saved in  "The Annals of R"  ...
>

the next version of the `fortunes' package will have

R> fortune(134)

Excellent, Berwin!
Specifically the part about why the bug never really triggers wrong
behavior. Your mail should be saved in `The Annals of R' ...
   -- Martin Maechler (after Berwin A Turlach reported a buglet in
  `spline_eval')
  R-devel (July 2005)

Best,

Torsten

> I'm fixing according to your proposal -- for "R-devel" or
> (SVN) R/trunk/ only.
>
> Martin Maechler, ETH Zurich
>
> __
> 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


[Rd] R news: Call for Papers

2005-09-12 Thread Torsten Hothorn

Dear useRs and developeRs,

the next issue of `R news' is scheduled for the beginning of November
and we are now  accepting submissions for this last issue in 2005.
For more information see

  http://cran.r-project.org/doc/Rnews/

If you are the author of a package on CRAN and you would like to promote
it a little bit, or if you simply have an interesting application using
R, we hope you can find some time to write a short article on it. We
suggest that it be approximately 3 pages or less. The idea of the
newsletter is that it be interesting to R users without being too
technical. For example an article describing a package could begin by
briefly outlining the statistical background and go on to demonstrate
the usage on some typical data set. Of course graphics are more than
welcome!

Bill Venables <[EMAIL PROTECTED]> is also encouraging submissions
to the more specialist Programmer's Niche column. In this case the
technical level could be a little higher, of course, but not necessarily:
ingeniousness is the key.

The R Help Desk column is intended to present answers to frequently
asked questions as well as tricks that are useful to the majority of
useRs. Please send submissions to Uwe Ligges <[EMAIL PROTECTED]>.

The deadline for submissions is

October, 8th, 2005

Keep the contributions rolling in!

The Editorial Board,

Doug Bates, Paul Murrell and Torsten Hothorn

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


Re: [Rd] Classification Trees and basic Random Forest pkg using tree structures in C

2005-11-07 Thread Torsten Hothorn

On Fri, 4 Nov 2005, Liaw, Andy wrote:
>
> For some of the data we encounter, all X variables are binary, so each data
> point can be encoded into a bitstring.  There are algorithms that take
> advantage of that.  The problem is interfacing such code with R.  I know of
> no good solutions.  As I told Grant, I thought about what he did, too, but
> the difficulty is how to pass such data structures to R.  Actually, some
> time down the road I might try to use the dendrogram class that's in R, and
> manipulate them in C.

I faced similar problems some time ago and ended up representing a
(binary) tree as recursive lists which can be manipulated from both the C
and R side. The `party' package has the code (and an internal random
forest function, however, without R interface yet) and the vignette
explains some details.

Best,

Torsten

> Not sure about efficiency though.
>
> Andy
>
>
> > Hin-Tak Leung
> >
> > __
> > 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
>
>

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


Re: [Rd] mosaicplot() update and clarification

2005-11-08 Thread Torsten Hothorn

>
> All,
>
> Again, my apologies for seeming to claim credit for
> your other mosaic implementation.  However, there are two
> sources of this confusion, and I hope the following helps.
>
> 1. "my" implementation (e.g. the one originally written for
> and included in S-Plus, then modified and improved for R
> by "KH") appears to have been included in a package
> called "vcd" at some point in time.  This was one of the
> first hits when I used googled "vcd".  See, for example:
>
> http://www.maths.lth.se/help/R/.R/library/vcd/html/mosaicplot.html
>
> 2. Once I load library(vcd) and do ?mosaicplot, the top of the
> help page does, in fact, say "package:vcd" although it credits me
> as the author?!  This was downloaded today from CRAN.  This most
> certainly is not my fault, nor do I want to take credit for
> something that isn't mine.  If {vcd} uses R:base's mosaicplot(),
> then, of course, everything is fine, but I gather from your email
> that this is not the case. So perhaps the {vcd} package needs to
> update its documentation.  If I am misunderstanding something,
> again, I apologize.

`mosaicplot' is a function in package `graphics' (and lists you as the
author) and `mosaic' is a function in package `vcd'. There _was_ a
function `vcd::mosaicplot' in older versions of the `vcd' package masking
`graphics::mosaicplot: `update.packages("vcd")' will update the package
and documentation on your system :-)

Best,

Torsten

>
> Anyway, the more interested people we have improving
> our graphics tools, the better!  !_)
>
> Cheers,
>
> Jay
>
>
> On Mon, 7 Nov 2005, Achim Zeileis wrote:
>
> > Jay:
> >
> > > Thanks, I'll send the code with the few changes marked
> > > with something obvious like,
> > >
> > > # JWE changed previous line,
> > >
> > > etc...
> > >
> > > I wasn't aware of the {vcd} implementation.  It looks like it
> > > is built on my original S-Plus code, too.
> >
> > Nope, everything written from scratch using Paul's wonderful grid
> > graphics. The internals look completely different and David's
> > implementation provides not only mosaic plots but also association and
> > sieve plots within the same framework.
> >
> > > Always nice to get the citation!
> >
> > ...give credit where credit is due...:-)
> > Best,
> > Z
> >
> > > Jay
> > >
> > >
> > > On Mon, 7 Nov 2005, Prof Brian Ripley wrote:
> > >
> > > > Jay,
> > > >
> > > > Having your code change to know exactly what you are suggesting
> > > > would be helpful.
> > > >
> > > > There is an enhanced version of mosaicplot called mosaic in package
> > > > vcd, and you might like to talk to its maintainers (if the facility
> > > > is not already there, as at a quick glance it seemed not to be).
> > > >
> > > > Brian
> > > >
> > > > On Mon, 7 Nov 2005, John W Emerson wrote:
> > > >
> > > > >
> > > > > Hi --
> > > > >
> > > > > I've found a need for an additional option to mosaicplot(), to
> > > > > suppress the labels.  It's not difficult, obviously, a minor
> > > > > thing.
> > > > >
> > > > > Would you like me to submit my revised code (I'll use your code
> > > > > rather than my original source code which was adapted for S-Plus
> > > > > and R)?  Or it might be a 5-minute change for the appropriate
> > > > > person.  No problem either way, just let me know.
> > > > >
> > > > > Cheers,
> > > > >
> > > > > Jay
> > > > >
> > > > > John Emerson
> > > > > Assistant Professor of Statistics
> > > > > Yale University
> > > > >
> > > > > __
> > > > > 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
> > >
> >
>
> __
> 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


[Rd] useR! 2006: submission & registration started!

2005-11-09 Thread Torsten Hothorn

We are happy to inform you that the online abstract submission and
registration for `useR! 2006' is now available online from
  http://www.R-project.org/useR-2006/

This second world meeting of the R user community will take place at
the Wirtschaftsuniversitaet Wien, Vienna, Austria, June 15 to 17 2006.
The conference schedule comprises keynote lectures and user-contributed
sessions as well as half-day tutorials presented by R experts on June 14,
2006, prior to the conference.

Keynote lectures addressing hot topics including data mining, graphics,
marketing or teaching with R will be presented by prominent speakers
including John Chambers, Jan de Leeuw, Brian Everitt, Travor Hastie, John
Fox, Stefano Iacus, Uwe Ligges, Paul Murrell, Peter Rossi, Simon Urbanek
and Sanford Weisberg.

The spectrum of user-contributed sessions will depend on your submissions.
Hence, we invite you to submit abstracts on topics presenting innovations
or exciting applications of R. The call for papers along with the link to
the online abstract submission is available at
  http://www.R-project.org/useR-2006/#Call

Before the start of the official program, half-day tutorials will be
offered on Wednesday, June 14th, a list of topics and speakers can be
found at
  http://www.R-project.org/useR-2006/Tutorials/

A special highlight of the conference will be a panel discussion on
`Getting recognition for excellence in computational statistics'. Editors
of well established journals in both computational and applied statistics
will discuss the impact of recent developments in computational statistics
on peer-reviewed journal publications. Currently, the panelists include
Jan de Leeuw (JSS), Brian Everitt (SMMR), Wolfgang Haerdle (CS), Nicholas
Jewell (SMGMB), Erricos Konthogiorges (CSDA), and Luke Tierney (JCGS).

Early birds fly until January 31st 2006, so now is the perfect time to
write and submit an abstract, register as a participant and plan your trip
to Vienna. The conference web page
  http://www.R-project.org/useR-2006/
has a link to a local hotel booking service and much more news.

See you in Vienna!
Torsten, Achim, David, Bettina, Kurt and Fritz

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


[Rd] typo in `eurodist'

2005-12-07 Thread Torsten Hothorn

R> attributes(eurodist)$Labels[9]
[1] "Gibralta"

should be `Gibraltar'.

Best,

Torsten

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


[Rd] useR! 2006 - Submission Deadline 2006-02-28

2006-01-24 Thread Torsten Hothorn


The submission deadline for `useR! 2006', the second R user conference to be
held in Vienna June 15-17 2006, is only four weeks ahead. Now is the perfect
time to submit abstracts for user-contributed sessions!

The sessions will be a platform to bring together R users, contributers,
package maintainers and developers in the S spirit that `users are developers'.
People from different fields will show us how they solve problems
with R in fascinating applications, including
  - Applied Statistics & Biostatistics
  - Bayesian Statistics
  - Bioinformatics
  - Econometrics & Finance
  - Machine Learning
  - Marketing
  - Robust Statistics
  - Spatial Statistics
  - Statistics in the Social and Political Sciences
  - Teaching
  - Visualization & Graphics
  - and many more.

We invite all R users to submit abstracts on topics presenting innovations or
exciting applications of R. A web page offering more information on the `useR!'
conference, abstract submission, registration and Vienna is available at

  http://www.R-project.org/useR-2006/

We will accept submissions until February 28, 2006.

Let the contributions roll in!


The organizing committee:

Torsten Hothorn, Achim Zeileis, David Meyer, Bettina Gruen,
Kurt Hornik and Friedrich Leisch

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


Re: [Rd] attributes on symbols

2017-07-07 Thread Torsten Hothorn


Here is a simpler example:


ex <- as.name("a")
attr(ex, "test") <- 1
quote(a)

a
attr(,"test")
[1] 1

Torsten

On Thu, 6 Jul 2017, William Dunlap wrote:


The multcomp package has code in multcomp:::expression2coef that attaches the 
'coef' attribute to
symbols.  Since there is only one symbol object in a session with a given name, 
this means that
this attaching has a global effect.  Should this be quietly allowed or should 
there be a warning or
an error?
E.g.,

str(quote(Education))
# symbol Education
lmod <- stats::lm(Fertility ~ ., data = datasets::swiss)
glmod <- multcomp::glht(lmod, c("Agriculture=0", "Education=0"))
str(quote(Education))
# symbol Education
# - attr(*, "coef")= num 1

Bill Dunlap
TIBCO Software
wdunlap tibco.com



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

[Rd] model.matrix memory problem (PR#13838)

2009-07-16 Thread Torsten . Hothorn

Hi,

`model.matrix' might kill R with a segfault (on a illposed problem, but anyway):

mydf <- as.data.frame(sapply(1:40, function(i) gl(2, 100)))
f <- as.formula(paste("~ - 1 + ", paste(names(mydf), collapse = ":"), sep = ""))
X <- model.matrix(f, data = mydf)

  *** caught segfault ***
address 0x18, cause 'memory not mapped'
Segmentation fault

Best wishes,
Torsten

--please do not edit the information below--

Version:
  platform = i686-pc-linux-gnu
  arch = i686
  os = linux-gnu
  system = i686, linux-gnu
  status =
  major = 2
  minor = 9.0
  year = 2009
  month = 04
  day = 17
  svn rev = 48333
  language = R
  version.string = R version 2.9.0 (2009-04-17)

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

Search Path:
  .GlobalEnv, package:stats, package:graphics, package:grDevices, 
package:utils, package:datasets, package:methods, Autoloads, package:base

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


Re: [Rd] mboost_1.1-3 blackboost_fit (PR#13972)

2009-09-28 Thread Torsten Hothorn



On Sun, 27 Sep 2009, Uwe Ligges wrote:

Please read the FAQs about submitting bug reports. Bugs in contributed 
packages must not go to the R-bugs repository but to the corresponding 
package maintainer, CCing in this case (I do not confirmed that it is a bug).




Ivan,

  bd <- party:::ctreedpp(y ~ ., data = dt, weights = NULL)

will do the job, however, not very nicely. mboost version 2.0-0 
(available from R-forge) can do better.


Best wishes,

Torsten




Best,
Uwe Ligges




bulls...@mail.ru wrote:

Full_Name: Ivan the Terrible
Version: 2.9.2
OS: Windows XP SP3
Submission from: (NULL) (89.110.13.151)


When using the method blackboost_fit of the package mboost appear following
error :
Error in party:::get_variables(o...@responses) :   trying to get slot 
"responses" from an object (class "boost_data") that is not

an S4 object

Simple test case that produce bug:

dt=expand.grid(y=c(2,3,4), x1=c(1,2), x2=c(1,2))
library(mboost)
bd=boost_dpp(y ~ .,data=dt, weights = NULL)
blackboost_fit(bd,tree_controls = ctree_control(
 teststat = "max",
 testtype = 
"Teststatistic",

 mincriterion = 0,
 maxdepth = 2
),
   fitmem = ctree_memory(
 bd, 
TRUE

),family = GaussReg(),
   control = boost_control(
   mstop = 2
  ),weights = NULL
  )


Test case session on my computer:


dt=expand.grid(y=c(2,3,4), x1=c(1,2), x2=c(1,2))
library(mboost)

Loading required package: modeltools
Loading required package: stats4
Loading required package: party
Loading required package: survival
Loading required package: splines
Loading required package: grid
Loading required package: coin
Loading required package: mvtnorm
Loading required package: zoo

Attaching package: 'zoo'


The following object(s) are masked from package:base :

 as.Date.numeric 
Loading required package: sandwich

Loading required package: strucchange
Loading required package: vcd
Loading required package: MASS
Loading required package: colorspace

bd=boost_dpp(y ~ .,data=dt, weights = NULL)
blackboost_fit(bd, 

+tree_controls = ctree_control(
+  teststat = "max",
+  testtype = 
"Teststatistic",

+  mincriterion = 0,
+  maxdepth = 2
+ ),
+fitmem = ctree_memory(
+  bd, + 
TRUE
+ ), +family = 
GaussReg(),

+control = boost_control(
+mstop = 2
+   ), +weights = NULL
+   )
Error in party:::get_variables(o...@responses) :   trying to get slot 
"responses" from an object (class "boost_data") that is not
an S4 object 

sessionInfo()
R version 2.9.2 (2009-08-24) i386-pc-mingw32 
locale:

LC_COLLATE=Russian_Russia.1251;LC_CTYPE=Russian_Russia.1251;LC_MONETARY=Russian_Russia.1251;LC_NUMERIC=C;LC_TIME=Russian_Russia.1251

attached base packages:
[1] grid  splines   stats graphics  grDevices utils datasets 
methods   base 
other attached packages:
 [1] mboost_1.1-3  party_0.9-999 vcd_1.2-4 colorspace_1.0-1 
MASS_7.2-48   strucchange_1.3-7
 [7] sandwich_2.2-1zoo_1.5-8 coin_1.0-6mvtnorm_0.9-7 
survival_2.35-4   modeltools_0.2-16


loaded via a namespace (and not attached):
[1] lattice_0.17-25 stats4_2.9.2 
__

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


[Rd] nlevels() is 0 and not NA

2007-04-24 Thread Torsten Hothorn

> nlevels(c("a", "b"))
[1] 0

but the documentation in R 2.5.0 (and earlier) says

If the argument is not a 'factor', 'NA' is returned.

I hope it isn't too late, I only came across this in a lecture this 
morning.

Best,

Torsten

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


[Rd] [SoC09-Idea] Party On!

2009-02-27 Thread Torsten Hothorn


Hi Manuel,

find our SoC proposal below.

Best wishes,

Torsten & Achim

___


Party On! New Recursive Partytioning Tools.

Mentor: Torsten Hothorn & Achim Zeileis

Short Description:
The aim of the project is the implementation of recursive partitioning
methods ("trees") which aren't available in R at the moment. The student
can choose a method to begin with from a larger set of interesting algorithms.

Detailed Description:
Recursive partitioning methods, or simply "trees", are simple yet powerful
methods for capturing regression relationships. Since the publication of the
automated interaction detection (AID) algorithm in 1964, many extensions,
modifications, and new approaches have been suggested in both the statistics
and machine learning communities. Most of the standard algorithms are
available to the R user, e.g., through packages rpart, party, mvpart, and
RWeka.

However, no common infrastructure is available for representing trees
fitted by different packages. Consequently, the capabilities for extraction
of information - such as predictions, printed summaries, or
visualizations - vary between packages and come with somewhat different user
interfaces. Furthermore, extensions or modifications often require considerable
programming effort, e.g., if the median instead of the mean of a numerical
response should be predicted in each leaf of an rpart tree.
Similarly, implementations of new tree algorithms might also require new
infrastructure if they have features not available in the above-mentioned
packages, e.g., multi-way splits or more complex models in the leafs.

To overcome these difficulties, the partykit package has been started on
R-Forge. It is still being developed but already contains a stable class
"party" for representing trees. It is a very flexible class with unified
predict(), print(), and plot() methods, and can, in principle, capture
all trees mentioned. But going beyond that, it can also accommodate
multi-way or functional splits, as well as complex models in (leaf) nodes.

We aim at making more recursive partitioning methods available
to the R community. A first step in this direction is the CHAID package 
(also hosted on R-Forge). Much more prominent procedures come to mind,

for example exhaustive CHAID, C4.5, GUIDE, CRUISE, LOTUS, and many others.
Students can choose among these and other recursive partitioning methods
they want to implement based on the partykit infrastructure.

Required Skills:
Good R programming skills, depending on the complexity of the chosen
algorithm C programming might be required as well. A basic understanding
of statistics and machine learning would be helpful.

Programming Exercise:
Consider the "GlaucomaM" dataset from package ipred. Write a small R function 
that searches for the best binary split in variable "vari" when "Class" is
the response variable. Implement any method you like but without using any 
add-on package.


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


[Rd] S3 generics without NS and cleanEx()

2006-02-15 Thread Torsten Hothorn

Good morning,

we recently observed a problem with importing S3 generics from a foreign 
package (without namespace), defining a S3 method in a package _with_ 
namespace and the `cleanEx()' function which is automatically generated 
and executed before examples are run by R CMD check.

To be more precise. Package `strucchange' defines a S3 generic

 sctest <- function(x, ...) UseMethod("sctest")

and the development version of `party' defines

 sctest.mob <- function(x, node = NULL, ...) {
 ...

which is exported in party's namespace

 S3method(sctest, mob)

Creating a `mob' object and running `sctest' on it works fine.

However, when we attach `party' and run `cleanEx()', the `sctest' method 
for `mob' is no longer found. Before `cleanEx()' we get

R> methods(sctest)
[1] sctest.Fstats  sctest.efp sctest.formula sctest.gefp 
sctest.mob*

and afterwards

R> methods(sctest)
[1] sctest.Fstats  sctest.efp sctest.formula sctest.gefp

is missing.

Debugging `cleanEx()' shows that those objects are removed from the 
global environment:

ls(envir = env, all.names = TRUE)
[1] ".Random.seed" ".__S3MethodsTable__." "GCtorture"
[4] "a""euro"

where the second one looks very suspicious.

`party_0.4-0.tar.gz' is available from

 http://www.imbe.med.uni-erlangen.de/~hothorn/party_0.4-0.tar.gz

and

 http://www.imbe.med.uni-erlangen.de/~hothorn/modeltools_0.2-3.tar.gz

is required.

The example below can be reproduced with both R-2.2.1 and R-2.3.0.

Best wishes,

Torsten



R> invisible(options(echo = TRUE))
R> ### * 
R> ###
R> attach(NULL, name = "CheckExEnv")
R> assign(".CheckExEnv", as.environment(2), pos = length(search())) # base
R> ## add some hooks to label plot pages for base and grid graphics
R> setHook("plot.new", ".newplot.hook")
R> setHook("persp", ".newplot.hook")
R> setHook("grid.newpage", ".gridplot.hook")
R> 
R> assign("cleanEx",
+function(env = .GlobalEnv) {
+  rm(list = ls(envir = env, all.names = TRUE), envir = env)
+RNGkind("default", "default")
+  set.seed(1)
+  options(warn = 1)
+  delayedAssign("T", stop("T used instead of TRUE"),
+ assign.env = .CheckExEnv)
+  delayedAssign("F", stop("F used instead of FALSE"),
+ assign.env = .CheckExEnv)
+  sch <- search()
+  newitems <- sch[! sch %in% .oldSearch]
+  for(item in rev(newitems))
+eval(substitute(detach(item), list(item=item)))
+  missitems <- .oldSearch[! .oldSearch %in% sch]
+  if(length(missitems))
+  warning("items ", paste(missitems, collapse=", "),
+  " have been removed from the search path")
+},
+env = .CheckExEnv)
R> assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now
R> assign("ptime", proc.time(), env = .CheckExEnv)
R> grDevices::postscript("party-Ex.ps")
R> assign("par.postscript", graphics::par(no.readonly = TRUE), env = 
.CheckExEnv)
R> options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly"))
R> options(warn = 1) 
R> library('party')
Loading required package: survival
Loading required package: splines
Loading required package: grid
Loading required package: modeltools
Loading required package: coin
Loading required package: mvtnorm
Loading required package: zoo
Loading required package: sandwich
Loading required package: strucchange
R> 
R> methods(sctest)
[1] sctest.Fstats  sctest.efp sctest.formula sctest.gefpsctest.mob*

Non-visible functions are asterisked
R> 
R> assign(".oldSearch", search(), env = .CheckExEnv)
R> assign(".oldNS", loadedNamespaces(), env = .CheckExEnv)
R> cleanEx(); ..nameEx <- "BinaryTree-class"
R> 
R> methods(sctest)
[1] sctest.Fstats  sctest.efp sctest.formula sctest.gefp 
R> 
R> 
R> proc.time()
[1] 1.77 0.01 1.97 0.00 0.00
R>

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


[Rd] conflicting S4 generics

2006-02-15 Thread Torsten Hothorn

Good morning again,

there is a second problem which keeps us from finishing new releases.

Package `kernlab' defines a `fit' S4 generic and `modeltools' does as 
well (so this is kind of an internal communication problem). `party' and 
`kernlab' define methods for `fit' and export them in their namespaces.

Now, when I attach `party' I get

R> library("party")
R> getMethods(fit)
model = "StatModel", data = "ModelEnv":
structure(function (model, data, ...)
[EMAIL PROTECTED](data, ...), class = structure("MethodDefinition", package = 
"methods"), target = structure(c("StatModel",
"ModelEnv"), .Names = c("model", "data"), class = structure("signature", 
package = "methods")), defined = structure(c("StatModel",
"ModelEnv"), .Names = c("model", "data"), class = structure("signature", 
package = "methods")))

model = "StatModel", data = "LearningSample":
structure(function (model, data, ...)
[EMAIL PROTECTED](data, ...), class = structure("MethodDefinition", package = 
"methods"), target = structure(c("StatModel",
"LearningSample"), .Names = c("model", "data"), class = 
structure("signature", package = "methods")), defined = 
structure(c("StatModel",
"LearningSample"), .Names = c("model", "data"), class = 
structure("signature", package = "methods")))

Now, when I additionally attach `kernlab', only the `kernlab' definitions 
remain active

R> getMethods(fit)
object = "ksvm":
structure(function (object)
[EMAIL PROTECTED], class = structure("MethodDefinition", package = "methods"), 
target = structure("ksvm", .Names = "object", class = 
structure("signature", package = "methods")), defined = structure("ksvm", 
.Names = "object", class = structure("signature", package = "methods")))

object = "gausspr":
structure(function (object)
[EMAIL PROTECTED], class = structure("MethodDefinition", package = "methods"), 
target = structure("gausspr", .Names = "object", class = 
structure("signature", package = "methods")), defined = 
structure("gausspr", .Names = "object", class = structure("signature", 
package = "methods")))

object = "rvm":
structure(function (object)
[EMAIL PROTECTED], class = structure("MethodDefinition", package = "methods"), 
target = structure("rvm", .Names = "object", class = 
structure("signature", package = "methods")), defined = structure("rvm", 
.Names = "object", class = structure("signature", package = "methods")))

object = "onlearn":
structure(function (object)
[EMAIL PROTECTED], class = structure("MethodDefinition", package = "methods"), 
target = structure("onlearn", .Names = "object", class = 
structure("signature", package = "methods")), defined = 
structure("onlearn", .Names = "object", class = structure("signature", 
package = "methods")))


and the `party' is over. Is there anything (except agreeing on a common 
signature) one can do about it?

Best wishes,

Torsten

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


Re: [Rd] S3 generics without NS and cleanEx()

2006-02-15 Thread Torsten Hothorn

On Wed, 15 Feb 2006, Prof Brian Ripley wrote:

> Follow up:
>
> You said
>
>>> which is exported in party's namespace
>>>
>>> S3method(sctest, mob)
>
> but that's not true: it is registered not exported.  You need to export it
> as strucchange does not have a namespace.
>

export(sctest.mob)

instead of

S3method(sctest, mob)

fixes the problem. Thanks!

Torsten

>
> On Wed, 15 Feb 2006, Prof Brian Ripley wrote:
>
>> Torsten,
>>
>> The error is that .__S3MethodsTable__. ends up in the global environment.
>> Are you importing sctest (I can't see it)?  I think that's the problem.
>>
>>> From R-exts:
>>
>> The standard method for S3-style @code{UseMethod} dispatching might fail
>> to locate methods defined in a package that is imported but not attached
>> to the search path.  To ensure that these methods are available the
>> packages defining the methods should ensure that the generics are
>> imported and register the methods using @code{S3method} directives.
>> 
>>
>> Brian
>>
>> On Wed, 15 Feb 2006, Torsten Hothorn wrote:
>>
>>>
>>> Good morning,
>>>
>>> we recently observed a problem with importing S3 generics from a foreign
>>> package (without namespace), defining a S3 method in a package _with_
>>> namespace and the `cleanEx()' function which is automatically generated
>>> and executed before examples are run by R CMD check.
>>>
>>> To be more precise. Package `strucchange' defines a S3 generic
>>>
>>> sctest <- function(x, ...) UseMethod("sctest")
>>>
>>> and the development version of `party' defines
>>>
>>> sctest.mob <- function(x, node = NULL, ...) {
>>> ...
>>>
>>> which is exported in party's namespace
>>>
>>> S3method(sctest, mob)
>>>
>>> Creating a `mob' object and running `sctest' on it works fine.
>>>
>>> However, when we attach `party' and run `cleanEx()', the `sctest' method
>>> for `mob' is no longer found. Before `cleanEx()' we get
>>>
>>> R> methods(sctest)
>>> [1] sctest.Fstats  sctest.efp sctest.formula sctest.gefp
>>> sctest.mob*
>>>
>>> and afterwards
>>>
>>> R> methods(sctest)
>>> [1] sctest.Fstats  sctest.efp sctest.formula sctest.gefp
>>>
>>> is missing.
>>>
>>> Debugging `cleanEx()' shows that those objects are removed from the
>>> global environment:
>>>
>>> ls(envir = env, all.names = TRUE)
>>> [1] ".Random.seed" ".__S3MethodsTable__." "GCtorture"
>>> [4] "a""euro"
>>>
>>> where the second one looks very suspicious.
>>>
>>> `party_0.4-0.tar.gz' is available from
>>>
>>> http://www.imbe.med.uni-erlangen.de/~hothorn/party_0.4-0.tar.gz
>>>
>>> and
>>>
>>> http://www.imbe.med.uni-erlangen.de/~hothorn/modeltools_0.2-3.tar.gz
>>>
>>> is required.
>>>
>>> The example below can be reproduced with both R-2.2.1 and R-2.3.0.
>>>
>>> Best wishes,
>>>
>>> Torsten
>>>
>>>
>>>
>>> R> invisible(options(echo = TRUE))
>>> R> ### * 
>>> R> ###
>>> R> attach(NULL, name = "CheckExEnv")
>>> R> assign(".CheckExEnv", as.environment(2), pos = length(search())) # base
>>> R> ## add some hooks to label plot pages for base and grid graphics
>>> R> setHook("plot.new", ".newplot.hook")
>>> R> setHook("persp", ".newplot.hook")
>>> R> setHook("grid.newpage", ".gridplot.hook")
>>> R>
>>> R> assign("cleanEx",
>>> +function(env = .GlobalEnv) {
>>> +  rm(list = ls(envir = env, all.names = TRUE), envir = env)
>>> +RNGkind("default", "default")
>>> +  set.seed(1)
>>> +  options(warn = 1)
>>> +  delayedAssign("T", stop("T used instead of TRUE"),
>>> + assign.env = .CheckExEnv)
>>> +  delayedAssign("F", stop("F used instead of FALSE"),
>>> + assign.env = .CheckExEnv)
>>> +  sch <- search()
>

Re: [Rd] S3 generics without NS and cleanEx()

2006-02-15 Thread Torsten Hothorn

On Wed, 15 Feb 2006, Prof Brian Ripley wrote:

> Torsten,
>
> The error is that .__S3MethodsTable__. ends up in the global environment.
> Are you importing sctest (I can't see it)?  I think that's the problem.
>

yes. But `strucchange' has no namespace and so I can't import `sctest' in 
the NAMESPACE file. Or am I missing something?

Thanks!

Torsten

>> From R-exts:
>
> The standard method for S3-style @code{UseMethod} dispatching might fail
> to locate methods defined in a package that is imported but not attached
> to the search path.  To ensure that these methods are available the
> packages defining the methods should ensure that the generics are
> imported and register the methods using @code{S3method} directives.
> 
>
> Brian
>
> On Wed, 15 Feb 2006, Torsten Hothorn wrote:
>
>>
>> Good morning,
>>
>> we recently observed a problem with importing S3 generics from a foreign
>> package (without namespace), defining a S3 method in a package _with_
>> namespace and the `cleanEx()' function which is automatically generated
>> and executed before examples are run by R CMD check.
>>
>> To be more precise. Package `strucchange' defines a S3 generic
>>
>> sctest <- function(x, ...) UseMethod("sctest")
>>
>> and the development version of `party' defines
>>
>> sctest.mob <- function(x, node = NULL, ...) {
>> ...
>>
>> which is exported in party's namespace
>>
>> S3method(sctest, mob)
>>
>> Creating a `mob' object and running `sctest' on it works fine.
>>
>> However, when we attach `party' and run `cleanEx()', the `sctest' method
>> for `mob' is no longer found. Before `cleanEx()' we get
>>
>> R> methods(sctest)
>> [1] sctest.Fstats  sctest.efp sctest.formula sctest.gefp
>> sctest.mob*
>>
>> and afterwards
>>
>> R> methods(sctest)
>> [1] sctest.Fstats  sctest.efp sctest.formula sctest.gefp
>>
>> is missing.
>>
>> Debugging `cleanEx()' shows that those objects are removed from the
>> global environment:
>>
>> ls(envir = env, all.names = TRUE)
>> [1] ".Random.seed" ".__S3MethodsTable__." "GCtorture"
>> [4] "a""euro"
>>
>> where the second one looks very suspicious.
>>
>> `party_0.4-0.tar.gz' is available from
>>
>> http://www.imbe.med.uni-erlangen.de/~hothorn/party_0.4-0.tar.gz
>>
>> and
>>
>> http://www.imbe.med.uni-erlangen.de/~hothorn/modeltools_0.2-3.tar.gz
>>
>> is required.
>>
>> The example below can be reproduced with both R-2.2.1 and R-2.3.0.
>>
>> Best wishes,
>>
>> Torsten
>>
>>
>>
>> R> invisible(options(echo = TRUE))
>> R> ### * 
>> R> ###
>> R> attach(NULL, name = "CheckExEnv")
>> R> assign(".CheckExEnv", as.environment(2), pos = length(search())) # base
>> R> ## add some hooks to label plot pages for base and grid graphics
>> R> setHook("plot.new", ".newplot.hook")
>> R> setHook("persp", ".newplot.hook")
>> R> setHook("grid.newpage", ".gridplot.hook")
>> R>
>> R> assign("cleanEx",
>> +function(env = .GlobalEnv) {
>> +   rm(list = ls(envir = env, all.names = TRUE), envir = env)
>> +RNGkind("default", "default")
>> +   set.seed(1)
>> +   options(warn = 1)
>> +   delayedAssign("T", stop("T used instead of TRUE"),
>> +  assign.env = .CheckExEnv)
>> +   delayedAssign("F", stop("F used instead of FALSE"),
>> +  assign.env = .CheckExEnv)
>> +   sch <- search()
>> +   newitems <- sch[! sch %in% .oldSearch]
>> +   for(item in rev(newitems))
>> +eval(substitute(detach(item), list(item=item)))
>> +   missitems <- .oldSearch[! .oldSearch %in% sch]
>> +   if(length(missitems))
>> +   warning("items ", paste(missitems, collapse=", "),
>> +   " have been removed from the search path")
>> +},
>> +env = .CheckExEnv)
>> R> assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for 
>> now
>> R> assign("ptime", proc.time(), env = .CheckExEnv)
>

Re: [Rd] profiling C code

2006-02-20 Thread Torsten Hothorn

On Mon, 20 Feb 2006, Liaw, Andy wrote:

> The last time I tried I didn't have much luck.  The gprof manual I could
> find seems to indicate that it can not profile code that are dynamically
> loaded.  (I was trying on Linux.)  The R source seems to hint otherwise.
> I'd very much appreciate pointers as well.
>

I happily use `oprofile' (web page at http://oprofile.sourceforge.net/) 
for profiling shared libs. You simply start a daemon, run your R code, 
and get the results. `opannotate' labels lines in C source files with the 
corresponding systime, very very cute.

Best,

Torsten

> Andy
>
> From: Ross Boylan
>>
>> Does anyone have any advice about profiling C/C++ code in a package
>> under R?  Does R need to be built specially for this to work?
>>
>> The FAQ has some entries about profiling but they cover R level
>> profiling; I'm try to get at the C++ code I've written that is called
>> from R.
>>
>> Primary target is Mac OS X.
>>
>> Thanks.
>>
>> Ross Boylan
>>
>> __
>> 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
>
>

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


Re: [Rd] profiling C code

2006-02-22 Thread Torsten Hothorn

>
> If you are running Linux, Torsten's suggestion of oprofile is a good one,
> provided you have root access (it seems to need it).  So I used in a root
> terminal (running the same example in another window in the middle)
>
> % opcontrol --no-vmlinux
> % opcontrol --start
>  run things ...

opcontrol --dump

doesn't require root privileges on my system and

> % opreport -l /users/ripley/R/R-devel/bin/exec/R
> % opreport -l /users/ripley/R/R-devel/library/stats/libs/stats.so

should be allowed for `normal users', too.

> ...
> (No unit mask) count 10
> samples  %symbol name
> 631.5789  bvalue_
> 421.0526  bsplvb_
> 315.7895  bsplvd_
> 210.5263  sbart_
> 210.5263  sslvrg_
> 1 5.2632  anonymous symbol from section .plt
> 1 5.2632  stxwx_
> % opannotate -s /users/ripley/R/R-devel/library/stats/libs/stats.so
> [Problem, root cannot read my source files]

for me, opannotate did not ask about running as `root'.

> % opcontrol --shutdown
>
> If there is a way to use this without root access I would like to know it,
> as only a few very privileged users get that here, and I am not going to
> open up root access to my private file server.

root needs to start the daemon via

opcontrol --start-daemon

and normal users can dump the output. But I don't know how a normal user 
would clean up and start new.

Best,

Torsten

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


[Rd] gsub + backslashes

2006-04-24 Thread Torsten Hothorn

Dear developeRs,

I thought that backslashes can be escaped in the usual way (and I think I 
did this before) but I can't see why

R> gsub("\\", "x", "\alpha")
Error in gsub(pattern, replacement, x, ignore.case, extended, fixed, 
useBytes) :
 invalid regular expression '\'

gives an error. Or am I just blind?

Best,

Torsten

R> version
_
platform   i686-pc-linux-gnu
arch   i686
os linux-gnu
system i686, linux-gnu
status Under development (unstable)
major  2
minor  4.0
year   2006
month  04
day18
svn rev37840
language   R
version.string R version 2.4.0 Under development (unstable) (2006-04-18 
r37840)

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


Re: [Rd] Package Unit Testing

2006-07-25 Thread Torsten Hothorn

On Mon, 24 Jul 2006, Gregor Gorjanc wrote:

> Martin Maechler  stat.math.ethz.ch> writes:
>
>>
>>> "miguel" == miguel manese  gmail.com>
>>> on Mon, 3 Jul 2006 09:43:12 +0800 writes:
>>
>> miguel> Hello, Do we have like an official unit testing
>> miguel> framework for packages? Like we do R CMD check, and
>> miguel> say the scripts in /test are executed?
>>
>> yes.  Just it's  "./tests",  not './test'.
>>
>> More specifically, all ./tests/*.R are executed and for those
>> foobar.R for which there's a  foobar.Rout.save  file,
>> the output is (R CMD Rdiff)ed agains the result of running foobar.R
>>
>> All this should be pretty obvious from the manual
>> "Writing R Extensions".
>> What was it in there that was not clear enough?
>
> I just tried to find relevant information and searched the whole Writing R
> Extensions manual on word test. I have find information Martin stated above,
> but failed to find how *.Rout.save should be created. I think that manual
> should say that. Did I miss something obvious? I am also not able to find
> Rdiff COMMAND in man page of R under Debian.
>
> Browsing a bit in sources reveals that *.Rout.save is copy of R session
> (starts with "welcome" text and later one code and output is there).
> But how does one generate such a file?

either R CMD BATCH or simply run R CMD check  once and copy 
.Rcheck/tests/*.Rout into /tests/*Rout.save

> Additionally, does testing also
> test the first "welcome" text - different version of R haave a bit different
> "welcome" text and that should be an error then or ...

R CMD check takes care of that.

Best,

Torsten

>
> Thanks!
>
> Gregor
>
> __
> 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


[Rd] Typo in print.default.Rd

2006-09-05 Thread Torsten Hothorn

line 17 has `intepretation', should read `interpretation'

Torsten

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


[Rd] R 2.4.0 @ R-project.org

2007-01-16 Thread Torsten Hothorn

R-project.org' News section still has

  R version 2.4.0 has been released on 2006-10-03.

Best wishes,

Torsten

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