[Rd] Using src/ to create executable - how to not build shared objects?

2011-02-21 Thread Henrik Bengtsson
Hi.

I can use the src/ directory to create executable, cf. Section
'Package subdirectories' in 'Writing R Extensions":

"A few packages use the src directory for purposes other than making a
shared object (e.g. to create executables). Such packages should have
files src/Makefile and src/Makefile.win (unless intended for only
Unix-alikes or only Windows)."

When doing this, how can I turn off the building of the shared objects
that are created under libs//?  Currently they end up in the
built package binaries, e.g. *.zip and *.tgz.

Thanks,

Henrik

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


[Rd] Problem with documentation of user-defined operator (S4 method)

2011-02-21 Thread Andreas Borg

Dear list members,

I have defined a binary operator %append% with methods for some S4 
classes. In my documentation file, I want to list the methods explicitly 
by using e.g.:


   \S4method{\%append\%}{RecLinkData,RecLinkData}(x, y)

In the HTML documentation this comes out right as
  
   ## S4 method for signature 'RecLinkResult,RecLinkResult'

   x %append% y

, but R CMD check raises the following warning:

   Bad \usage lines found in documentation object '%append%-methods':
 S4method{%append%}{RecLinkData,RecLinkData}(x, y)

Any idea what is wrong?

I have seen this behaviour with R 2.12.0 and 2.12.1.

Best regards and thanks for any suggestion,

Andreas

--
Andreas Borg
Medizinische Informatik

UNIVERSITÄTSMEDIZIN
der Johannes Gutenberg-Universität
Institut für Medizinische Biometrie, Epidemiologie und Informatik
Obere Zahlbacher Straße 69, 55131 Mainz
www.imbei.uni-mainz.de

Telefon +49 (0) 6131 175062
E-Mail: b...@imbei.uni-mainz.de

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. 
Wenn Sie nicht der
richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren 
Sie bitte sofort den
Absender und löschen Sie diese Mail. Das unerlaubte Kopieren sowie die 
unbefugte Weitergabe
dieser Mail und der darin enthaltenen Informationen ist nicht gestattet.

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


Re: [Rd] Problem with documentation of user-defined operator (S4 method)

2011-02-21 Thread Andreas Borg

Just to add this, the operator is defined as follows:

standardGeneric for "%append%" defined from package "RecordLinkage"

function (x, y)
standardGeneric("%append%")

Methods may be defined for arguments: x, y
Use  showMethods("%append%")  for currently available ones.

So this is not a problem of misspelled arguments. The involved class is 
an S3 class made usable to S4 methods by "oldClass".


Andreas Borg schrieb:

Dear list members,

I have defined a binary operator %append% with methods for some S4 
classes. In my documentation file, I want to list the methods 
explicitly by using e.g.:


   \S4method{\%append\%}{RecLinkData,RecLinkData}(x, y)

In the HTML documentation this comes out right as
 ## S4 method for signature 'RecLinkResult,RecLinkResult'
   x %append% y

, but R CMD check raises the following warning:

   Bad \usage lines found in documentation object '%append%-methods':
 S4method{%append%}{RecLinkData,RecLinkData}(x, y)

Any idea what is wrong?

I have seen this behaviour with R 2.12.0 and 2.12.1.

Best regards and thanks for any suggestion,

Andreas




--
Andreas Borg
Medizinische Informatik

UNIVERSITÄTSMEDIZIN
der Johannes Gutenberg-Universität
Institut für Medizinische Biometrie, Epidemiologie und Informatik
Obere Zahlbacher Straße 69, 55131 Mainz
www.imbei.uni-mainz.de

Telefon +49 (0) 6131 175062
E-Mail: b...@imbei.uni-mainz.de

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. 
Wenn Sie nicht der
richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren 
Sie bitte sofort den
Absender und löschen Sie diese Mail. Das unerlaubte Kopieren sowie die 
unbefugte Weitergabe
dieser Mail und der darin enthaltenen Informationen ist nicht gestattet.

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


Re: [Rd] Accessing Package NEWS (NEWS.Rd)

2011-02-21 Thread Kurt Hornik
> Paul Roebuck writes:

> Okay. So, after having spent quite some time never really tracking down
> why my package NEWS files were unacceptable to readNEWS(), I
> noticed that there was recent (to me anyway) development that allowed
> the NEWS to be done as an Rd file. Sweet! A more standard format...

> I converted a NEWS file in one of my unreleased packages to Rd format.
> checkNEWS() gave it a thumbs up.

> But then it went south. Tried the following after installation:

All of this works much better for r-devel: in particular, this makes
clear that checkNEWS is for old-style (pre 2.12.0) R NEWS files ...

Best
-k

>> checkNEWS("myapp/trunk/MyApp/inst/NEWS.Rd")
> [1] TRUE
>> news(package="MyApp")

> Nothing.

> Debugging news() itself left me wondering. The first thing checked
> for was 'inst/NEWS.Rd' - once I install the package, that would never
> exist though, right? Should tools:::.build_news_db() instead use:

> nfile <- file.path(dir, c("NEWS.Rd", file.path("inst", "NEWS.Rd")))

> On the slim chance it should, I modified the path to my
> source folder's copy and continued debugging into 
> tools:::.build_news_db_from_package_NEWS_Rd().


> debug: ind <- grepl(re_v, nms, ignore.case = TRUE)
> Browse[2]> 
> debug: if (!all(ind)) warning("Cannot extract version info from the following 
> section titles:\n", 
> Browse[2]> ind
> [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
> Browse[2]> 
> debug: NULL
> Browse[2]> 
> debug: .make_news_db(cbind(ifelse(ind, sub(re_v, "\\1", nms), NA_character_), 
> ifelse(grepl(re_d, nms), sub(re_d, "\\1", nms), NA_character_), 
> db[, 2L], sub("\n*$", "", db[, 3L])), logical(nrow(db)), 
> "news_db_from_Rd")
> Browse[2]> 
> debugging in: .make_news_db(cbind(ifelse(ind, sub(re_v, "\\1", nms), 
> NA_character_), 
> ifelse(grepl(re_d, nms), sub(re_d, "\\1", nms), NA_character_), 
> db[, 2L], sub("\n*$", "", db[, 3L])), logical(nrow(db)), 
> "news_db_from_Rd")
> debug: {
> out <- data.frame(x, row.names = NULL, stringsAsFactors = FALSE)
> colnames(out) <- c("Version", "Date", "Category", "Text")
> if (!is.null(bad)) 
> attr(out, "bad") <- bad
> class(out) <- unique(c(classes, "news_db", "data.frame"))
> out
> }
> Browse[3]> 
> debug: out <- data.frame(x, row.names = NULL, stringsAsFactors = FALSE)
> Browse[3]> 
> debug: colnames(out) <- c("Version", "Date", "Category", "Text")
> Browse[3]> 
> debug: if (!is.null(bad)) attr(out, "bad") <- bad
> Browse[3]> 
> debug: attr(out, "bad") <- bad
> Browse[3]> 
> debug: class(out) <- unique(c(classes, "news_db", "data.frame"))
> Browse[3]> 
> debug: out
> Browse[3]> 
> exiting from: .make_news_db(cbind(ifelse(ind, sub(re_v, "\\1", nms), 
> NA_character_), 
> ifelse(grepl(re_d, nms), sub(re_d, "\\1", nms), NA_character_), 
> db[, 2L], sub("\n*$", "", db[, 3L])), logical(nrow(db)), 
> "news_db_from_Rd")
> exiting from: tools:::.build_news_db_from_package_NEWS_Rd(newsfile)
> Error: invalid version specification CHANGES IN VERSION 1.0.0CHANGES IN 
> VERSION 1.0.1CHANGES IN VERSION 2.0.0


> Well, so it didn't like my version numbers. But is the regexp check correct?

> Browse[2]> .standard_regexps()$valid_package_version
> [1] "([[:digit:]]+[.-]){1,}[[:digit:]]+"

> Would appear as though packages with only major.minor comparisons would
> pass. Or did I miss something...


> 
> P.S. Another thing I didn't see specified was whether this was an acceptable 
> format
> in current Rd format:

> \section{CHANGES IN VERSION 2.0.0}{

> Trying to get original TEXT files to be read by readNEWS(), the sections had 
> to
> read "CHANGES IN R VERSION nnn". Using Rd format, checkNEWS() seemed
> to allow optionally using a package name instead (of 'R'). As it also allowed 
> using
> nothing, i went with that. What's the intended canonical format?

> __
> 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] Using src/ to create executable - how to not build shared objects?

2011-02-21 Thread Simon Urbanek

On Feb 21, 2011, at 3:14 AM, Henrik Bengtsson wrote:

> Hi.
> 
> I can use the src/ directory to create executable, cf. Section
> 'Package subdirectories' in 'Writing R Extensions":
> 
> "A few packages use the src directory for purposes other than making a
> shared object (e.g. to create executables). Such packages should have
> files src/Makefile and src/Makefile.win (unless intended for only
> Unix-alikes or only Windows)."
> 
> When doing this, how can I turn off the building of the shared objects
> that are created under libs//?  Currently they end up in the
> built package binaries, e.g. *.zip and *.tgz.
> 

If you build an executable then it won't be copied anyway. If you are building 
something that looks like a shared object then I'm a bit puzzled why you would 
not want to install it as that is the only way you can install it in multi-arch 
build (since you can't use inst in that case). That said, you can simply build 
your "executable" in a subdirectory which is I'd recommend for anything other 
than contents that you want R to deal with -- but, again, beware of multi-arch 
settings as it's get really tricky.

Cheers,
Simon

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


[Rd] [R] S4 classes: referencing slots with other slots

2011-02-21 Thread Dan Murphy
Dear Development Group,

In trying to answer the subject question myself, I found this thread
initiated by Tony from five years ago:
http://tolstoy.newcastle.edu.au/R/help/05/12/18169.html. I recently stumbled
upon the following S4 answer to Tony's question:

setClass("fooWfcn",
representation(dat1="vector",
dat2="vector",
fn1="function",
fn2="function"),
prototype=prototype(dat1=0:10, dat2=10:20)
)

setMethod("initialize", "fooWfcn", function(.Object, ...) {
.Object <- callNextMethod()
.Object@fn1 <- function(x) { return(x - mean(.Object@dat1)) }
.Object@fn2 <- function(x) { mean(.Object@dat2) }
.Object
})

foo <- new("fooWfcn")
foo@fn1(0)  # -5
foo@fn2()   # 15
foo2 <- new("fooWfcn", dat1 = 11:20)
foo2@fn1(0) # -15.5

(If this is well-known, I apologize, but I could not find it anywhere.)

Before going too far down the road under the assumption that this S4
self-referencing-via-initialize mechanism will always work (so far so good,
in broad contexts) I would be grateful for some confirmation from the
development team that this "happy accident" will not suddenly disappear. :-(

Thank you,

Dan Murphy

[[alternative HTML version deleted]]

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


[Rd] Error in tools::build Vignettes (dir = ".")

2011-02-21 Thread Thomas Roth
Dear List,

Recently i changed my environment switching from 32bit XP to 64bit W7. I'm
trying to rebuild my package with R 2.12.1 (2010-12-16)

R CMD check --> everything ok, no warning, error nothing

BUT

R CMD build --> Error in tools::build Vignettes (dir = ".") : Execution of
make failed  (translated output)


However, if i take the commands from the makefile, they all work out fine.
Any hints?

Best Whishes,

Thomas

[[alternative HTML version deleted]]

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


Re: [Rd] Error in tools::build Vignettes (dir = ".")

2011-02-21 Thread Prof Brian Ripley

On Mon, 21 Feb 2011, Thomas Roth wrote:


Dear List,

Recently i changed my environment switching from 32bit XP to 64bit W7. I'm
trying to rebuild my package with R 2.12.1 (2010-12-16)

R CMD check --> everything ok, no warning, error nothing

BUT

R CMD build --> Error in tools::build Vignettes (dir = ".") : Execution of
make failed  (translated output)


I presume you mean tools::buildVignettes, no space.


However, if i take the commands from the makefile, they all work out fine.
Any hints?


Well, normally the system gives you some output before that message. 
All you need to do is to cd to your package's inst/doc directory, run 
'make' and see what is reported.  This doesn't look like an R issue, 
more to do with your Makefile or your environment.




Best Whishes,

Thomas

[[alternative HTML version deleted]]


Please do review the posting guide and not send HTML when explicitly 
asked not to.



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



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


[Rd] Anomaly in [.terms

2011-02-21 Thread Terry Therneau
 This arose when working on an addition to coxph, which has the features
that the X matrix never has an intercept column, and we remove strata()
terms before computing an X matrix.  The surprise: when a terms object
is subset the intercept attribute is turned back on.
  My lines 2 and 3 below were being executed just before a call to
model.frame.  The simple solution was of course to do them in the
opposite order so I am not waiting on a "fix". 
  Not to mention that I am not sure a fix is required, though I was
surprised. 
Terry T.


tmt1131% R

R version 2.12.0 (2010-10-15)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-unknown-linux-gnu (64-bit)

> test <- terms(Surv(time, status) ~ age + strata(ph.ecog),
+specials='strata')

> attr(test, 'intercept') <- 0  #turn off intercept
> test <- test[-2]   #remove strata

> test
Surv(time, status) ~ age
attr(,"variables")
list(Surv(time, status), age)
attr(,"factors")
   age
Surv(time, status)   0
age  1
attr(,"term.labels")
[1] "age"
attr(,"specials")
attr(,"specials")$strata
NULL

attr(,"order")
[1] 1
attr(,"intercept")
[1] 1
attr(,"response")
[1] 1

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


Re: [Rd] Anomaly in [.terms

2011-02-21 Thread Prof Brian Ripley

From the NEWS for 2.13.0-to-be


  \item \code{drop.terms} and the \code{[} method for class
  \code{"terms"} no longer add back an intercept.  (Reported by
  Niels Hansen.)

so it has been fixed, just not rolled out yet.

On Mon, 21 Feb 2011, Terry Therneau wrote:


This arose when working on an addition to coxph, which has the features
that the X matrix never has an intercept column, and we remove strata()
terms before computing an X matrix.  The surprise: when a terms object
is subset the intercept attribute is turned back on.
 My lines 2 and 3 below were being executed just before a call to
model.frame.  The simple solution was of course to do them in the
opposite order so I am not waiting on a "fix".
 Not to mention that I am not sure a fix is required, though I was
surprised.
   Terry T.


tmt1131% R

R version 2.12.0 (2010-10-15)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-unknown-linux-gnu (64-bit)


test <- terms(Surv(time, status) ~ age + strata(ph.ecog),

+specials='strata')


attr(test, 'intercept') <- 0  #turn off intercept
test <- test[-2]   #remove strata



test

Surv(time, status) ~ age
attr(,"variables")
list(Surv(time, status), age)
attr(,"factors")
  age
Surv(time, status)   0
age  1
attr(,"term.labels")
[1] "age"
attr(,"specials")
attr(,"specials")$strata
NULL

attr(,"order")
[1] 1
attr(,"intercept")
[1] 1
attr(,"response")
[1] 1

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



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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