Re: [Rd] getNativeSymbolInfo fails with Fortran symbol.

2008-04-10 Thread Prof Brian Ripley
It's a bug -- unlike is.loaded, getNativeSymbolInfo seems unaware of 
Fortran names unless registered.

Will be fixed in 2.7.0.

On Wed, 9 Apr 2008, [EMAIL PROTECTED] wrote:

>
>
> In the following code routine 'initaquaphy' is defined in Fortran,
> and dynamically loaded into R.:
>
> test.f:
>
>
>  subroutine initaquaphy(odeparms)
>
>  external odeparms
>  double precision pars(19)
>  common /myparms/pars
>
>   call odeparms(19, pars)
>
>  return
>  end
>
> $ R CMD SHLIB Aquaphy.f
> gfortran   -fpic  -g -O2 -c test.f -o test.o
> gcc -std=gnu99 -shared -L/usr/local/lib -o test.so test.o  -lgfortran -lm
>
>
> and linked into the package dll (or so).  Help for is.loaded() and
> getNativeSymbolInfo() say not to use symbol.For() to convert
> to Fortran-specific symbols.  However, on Linux, getNativeSymbolInfo
> is unable to find 'initaquaphy' in 'test.so', but does find
> 'initaquaphy_'.  Note that is.loaded() works as advertised.  Furthermore,
> this code works in Windows, R-2.6.2patched44759.
>
> triggerbug.R:
>
> system("R CMD SHLIB test.f")
> dyn.load(paste("test",.Platform$dynlib.ext,sep=""))
> is.loaded("initaquaphy", PACKAGE="test")
> getNativeSymbolInfo("initaquaphy_", PACKAGE="test")
> getNativeSymbolInfo("initaquaphy", PACKAGE="test")
> cat("All Done")
>
> Resulting in:
>
>> source("triggerbug.R", echo=TRUE, print.eval=TRUE)
>
>> system("R CMD SHLIB test.f")
> gfortran   -fpic  -g -O2 -c test.f -o test.o
> gcc -std=gnu99 -shared -L/usr/local/lib -o test.so test.o  -lgfortran -lm
>
>> dyn.load(paste("test",.Platform$dynlib.ext,sep=""))
>
>> is.loaded("initaquaphy", PACKAGE="test")
> [1] TRUE
>
>> getNativeSymbolInfo("initaquaphy_", PACKAGE="test")
> $name
> [1] "initaquaphy_"
>
> $address
> 
> attr(,"class")
> [1] "NativeSymbol"
>
> $package
> DLL name: test
> Filename: /home/setzer/tasks/Programming_Projects/test.so
> Dynamic lookup: TRUE
>
> attr(,"class")
> [1] "NativeSymbolInfo"
>
>> getNativeSymbolInfo("initaquaphy", PACKAGE="test")
> Error in FUN("initaquaphy"[[1L]], ...) :
>  no such symbol initaquaphy in package test
>>
>
> Have I misunderstood the help page, or is this a bug?
>
> --please do not edit the information below--
>
> Version:
> platform = i686-pc-linux-gnu
> arch = i686
> os = linux-gnu
> system = i686, linux-gnu
> status = beta
> major = 2
> minor = 7.0
> year = 2008
> month = 04
> day = 07
> svn rev = 45159
> language = R
> version.string = R version 2.7.0 beta (2008-04-07 r45159)
>
> 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
>
> Search Path:
> .GlobalEnv, package:deSolve, package:stats, package:graphics, 
> package:grDevices, package:utils, package:datasets, package:methods, 
> Autoloads,
> package:base
>
> R. Woodrow Setzer, Ph. D.
> National Center for Computational Toxicology
> http://www.epa.gov/comptox
> US Environmental Protection Agency
> Mail Drop B205-01/US EPA/RTP, NC 27711
> Ph: (919) 541-0128Fax: (919) 541-1194
>
> __
> 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] Windows problem related to using shortPathName for Sweave style file

2008-04-10 Thread Duncan Murdoch
On 4/9/2008 9:50 PM, Patrick Aboyoun wrote:
> I forgot to mention the BioConductor Windows build machine is running
> Microsoft Windows Server 2003 R2
> Enterprise Edition, SP2
> 
> I just checked and this same problem exists if I place R in the standard 
> "C:\Program Files\R" location on this machine.

We're going to roll back that change, so you should be okay with your 
original setup.  As far as I know there is no way to get MikTeX to work 
if you have a space in your pathname, so putting R in the standard 
location will fail, unless you follow the advice I give below.

> For now the backup plan is to move to using short path names for 
> BioConductor builds (modifying 100+ vignettes is impractical as well as 
> configuring MiKTeX to handle multiple installs of R that the build 
> machine uses). If there is an alternate configuration that I should be 
> using, just let me know.

I would recommend biting the bullet and adding \usepackage{Sweave} to 
every vignette.  It's just a one line addition to them, and it will mean 
that their .tex output will work if you move it to a different machine, 
where the full path to Sweave.sty is different.

Duncan Murdoch

> 
> 
> Cheers,
> Patrick
> 
> 
> Duncan Murdoch wrote:
>> On 09/04/2008 5:23 PM, Patrick Aboyoun wrote:
>>> Something funky happened to my e-mail. I was trying to paste 
>>> information related to MiKTeX and R into my message and it appears to 
>>> have corrupted the text somehow. Anyway, the message I was trying to 
>>> get across is that the tex file contains the path
>>>
>>> \usepackage{E:/paboyoun/BBS-2~1.2-B/R/share/texmf/Sweave}
>>>
>>> and MiKTeX 2.7 doesn't know how to resolve it. (The Bioconductor.tex 
>>> file is (hopefully) attached to this e-mail.)
>>
>> You should be able to get things to work by explicitly putting
>>
>> \usepackage{Sweave}
>>
>> somewhere early in your .Rnw file.  You may have trouble with MikTeX 
>> finding Sweave.sty, depending how you invoke it:  if invoked from R 
>> CMD it should work, but maybe not from your command line unless you 
>> tell it where to look for include files.  How you do that changes all 
>> the time; R tries a couple, which is why R CMD probably works.
>>
>> Duncan Murdoch
>>
>>>
>>>
>>> === BEGIN OS BLOCK ===
>>>
>>> E:\paboyoun>pdflatex --version
>>> MiKTeX-pdfTeX 2.7.2987 (1.40.7) (MiKTeX 2.7)
>>> Copyright (C) 1982 D. E. Knuth, (C) 1996-2006 Han The Thanh
>>> TeX is a trademark of the American Mathematical Society.
>>>
>>> E:\paboyoun>pdflatex Bioconductor.tex
>>> This is pdfTeX, Version 3.141592-1.40.7 (MiKTeX 2.7)
>>> entering extended mode
>>> (Bioconductor.tex
>>> LaTeX2e <2005/12/01>
>>> Babel  and hyphenation patterns for english, dumylang, 
>>> nohyphenation, ge
>>> rman, ngerman, french, loaded.
>>> ("C:\Program Files\MiKTeX 2.7\tex\latex\base\article.cls"
>>> Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
>>> ("C:\Program Files\MiKTeX 2.7\tex\latex\base\size12.clo"))
>>> ("C:\Program Files\MiKTeX 2.7\tex\latex\psnfss\times.sty")
>>> ("C:\Program Files\MiKTeX 2.7\tex\latex\hyperref\hyperref.sty"
>>> ("C:\Program Files\MiKTeX 2.7\tex\latex\graphics\keyval.sty")
>>> ("C:\Program Files\MiKTeX 2.7\tex\latex\oberdiek\hycolor.sty")
>>> ("C:\Program Files\MiKTeX 2.7\tex\latex\hyperref\pd1enc.def")
>>> ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\etexcmds.sty"
>>> ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\infwarerr.sty"))
>>> ("C:\Program Files\MiKTeX 2.7\tex\latex\00miktex\hyperref.cfg")
>>> ("C:\Program Files\MiKTeX 2.7\tex\latex\oberdiek\kvoptions.sty")
>>> Implicit mode ON; LaTeX internals redefined
>>> ("C:\Program Files\MiKTeX 2.7\tex\latex\ltxmisc\url.sty")
>>> ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\bitset.sty"
>>> ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\intcalc.sty")
>>> ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\bigintcalc.sty"
>>> ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\pdftexcmds.sty")))
>>> ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\kvsetkeys.sty")
>>> ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\atbegshi.sty"
>>> ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\ifpdf.sty")))
>>> *hyperref using default driver hpdftex*
>>> ("C:\Program Files\MiKTeX 2.7\tex\latex\hyperref\hpdftex.def")
>>> ! Missing \endcsname inserted.
>>> 
>>>\protect
>>> l.28 \begin
>>>{document}
>>> ?
>>>
>>>
>>> 
>>>
>>> __
>>> 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] ISOdate/ISOdatetime performance suggestions, other date/time questions

2008-04-10 Thread Sklyar, Oleg (MI London)
Dear list:

working with date/times I have come across a problem that ISOdate and
ISOdatetime are too slow on large vectors of data. I was surprised just
until I looked at the implementation and the man page: "ISOdatetime and
ISOdate are convenience wrappers for strptime". In other terms, they
convert data to character representation first in order to create a
POSIXlt object that is then converted to POSIXct. And POSIXct, i.e. the
number of seconds since 1970, is really what one wants most often.

Obviously this is not a bug, but it is really a suboptimal
implementation of a pretty important function as the example below
shows.

Now my questions are:

- any chance that the implementation can be changed in R (suggested,
well tz needs to be added)?
- is there a better pure-R (no-C) way than that shown below to convert
to POSIXct?
- any idea why in the example below fooling R into thinking a list is
POSIXlt is faster than just creating a POSIXlt by rep or seq? It's not a
huge difference, but still. Unfortunately seq on POSIXlt returns POSIXct
anyway, so the class of 'origin' is set correctly.
- any idea why seq is faster than rep when applied on POSIXct? There is
hardly anything simpler than on double values...

Thanks in advance for your comments,
Oleg

It's common in finance to work with time stamps stored in a form like
%Y%m%d.%H%M%OS, e.g. 20080410.140444 for now, this is what 'ts' in the
example below is:

ts = 1e4*trunc(rnorm(5,2008,2)) + 1e2*trunc(runif(5,1,12)) + 
 trunc(runif(5,1,28)) + 1e-2*trunc(runif(5,1,24)) +
 1e-4*trunc(runif(5,1,60)) + 1e-6*runif(5,1,60)

posix.viaISOdate = function(x) {
date = trunc([EMAIL PROTECTED])
time = round([EMAIL PROTECTED],2)
rtime = round(time)
z = list(sec=rtime%%1e2 + time%%1,
min=(rtime%/%1e2)%%1e2,
hour=rtime%/%1e4,
mday=date%%100,
mon=(date%/%100)%%100,
year=date%/%1)
ISOdate(z$year,z$mon,z$mday,z$hour,z$min,z$sec) # to POSIXct
}

## This is just a test of how is it faster to create a long POSIXlt
object
## before another implementations are given

origin = as.POSIXct("1970-01-01") 

mean(sapply(1:25,function(i) system.time(
as.POSIXlt(rep(origin,60))
))[1,])
# [1] 0.3972

mean(sapply(1:25,function(i) system.time(
as.POSIXlt(seq(origin, origin, length.out=60))
))[1,])
# [1] 0.30528


posix.viaPOSIXlt1 = function(x) {
origin = as.POSIXct("1970-01-01") 
z = as.POSIXlt(seq(origin, origin, length.out=length(x)))
date = trunc([EMAIL PROTECTED])
time = round([EMAIL PROTECTED],2)
rtime = round(time)
z$sec=rtime%%1e2 + time%%1
z$min=(rtime%/%1e2)%%1e2
z$hour=rtime%/%1e4
z$mday=date%%100
z$mon=(date%/%100)%%100-1
z$year=date%/%1-1900
as.double(z) # to POSIXct
}

posix.vialist = function(x) {
date = trunc([EMAIL PROTECTED])
time = round([EMAIL PROTECTED],2)
rtime = round(time)
na = rep(0.0,length(x))
z = list(sec=rtime%%1e2 + time%%1,
min=(rtime%/%1e2)%%1e2,
hour=rtime%/%1e4,
mday=date%%100,
mon=(date%/%100)%%100-1,
year=date%/%1-1900,
wday=na,yday=na,isdst=na)
class(z) = c("POSIXt","POSIXlt")
as.double(z) # to POSIXct
}

v1 = posix.viaISOdate(ts)
v2 = posix.viaPOSIXlt1(ts)
v3 = posix.vialist(ts)

all(v1==v2 & v2==v3)
# [1] TRUE

mean(sapply(1:25,function(i) system.time(
system.time(posix.viaISOdate(ts))
))[1,])
# [1] 1.54244

mean(sapply(1:25,function(i) system.time(
system.time(posix.viaPOSIXlt1(ts))
))[1,])
# [1] 0.37624

mean(sapply(1:25,function(i) system.time(
system.time(posix.vialist(ts))
))[1,])
# [1] 0.35488




sessionInfo()
R version 2.6.2 (2008-02-08)
x86_64-unknown-linux-gnu

locale:
LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=C;LC_MO
NETARY=en_GB.UTF-8;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_IDENTIFICATI
ON=C

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

loaded via a namespace (and not attached):
[1] rcompgen_0.1-17

Dr Oleg Sklyar
Technology Group
Man Investments Ltd
+44 (0)20 7144 3803
[EMAIL PROTECTED]


**
The contents of this email are for the named addressee(s) only.
It contains information which may be confidential and privileged.
If you are not the intended recipient, please notify the sender
immediately, destroy this email and any attachments and do not
otherwise disclose or use them. Email transmission is not a
secure method of communication and Man Investments cannot accept
responsibility for the completeness or accuracy of this email or
any attachments. Whilst Man Investments makes every effort to keep
its network free from viruses, it does not accept responsibility
for any computer virus which might be transferred by way of this
email or any attachments. This email

[Rd] make check problems

2008-04-10 Thread William Knebel
I am attemting to build R from source and test R on NetBSD AMD64 and
i386.  I have run the configure and build steps successfully for
R-2.3.1, R-2.6.0, and R-2.6.2. However, the suite of tests accessed by
"make check" fails in numerous places.  In some cases, the failure is
expected, for example not using iconv libraries so the test for these
libraries does not execute. In other cases, the errors are not as easy
to diagnose.  In one case it was an error with the function qcauchy
(see error below).

qcauchy(c(-Inf, 0), log = TRUE) == II is not all TRUE
In addition: Warning message:
NaNs produced in: qcauchy(p, location, scale, lower.tail, log.p)
Execution halted

My questions are general.  Is it expected that the "make check" suite
of tests will complete without errors? (R Administration/Installation
page indicates that errors are not necessarily pathologic for a bad
build). Is it necessary to sucessfully complete the "make check" suite
of tests to "accept" an R installation for use? I work in a regulated
environment and the initial thought was that "passing" the "make
check" tests would be sufficient to accept a built-from-source R
install. 

Any thoughts?

Bill

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


Re: [Rd] ISOdate/ISOdatetime performance suggestions, other date/time questions

2008-04-10 Thread Sklyar, Oleg (MI London)
small correction:

# to ensure 0, although it will be overwritten when assigning hour
origin = as.POSIXct("1970-01-01")-as.numeric(as.POSIXct("1970-01-01")) 

Dr Oleg Sklyar
Technology Group
Man Investments Ltd
+44 (0)20 7144 3803
[EMAIL PROTECTED] 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Sklyar, 
> Oleg (MI London)
> Sent: 10 April 2008 14:52
> To: R-devel@r-project.org
> Subject: [Rd] ISOdate/ISOdatetime performance suggestions, 
> other date/time questions
> 
> Dear list:
> 
> working with date/times I have come across a problem that 
> ISOdate and ISOdatetime are too slow on large vectors of 
> data. I was surprised just until I looked at the 
> implementation and the man page: "ISOdatetime and ISOdate are 
> convenience wrappers for strptime". In other terms, they 
> convert data to character representation first in order to 
> create a POSIXlt object that is then converted to POSIXct. 
> And POSIXct, i.e. the number of seconds since 1970, is really 
> what one wants most often.
> 
> Obviously this is not a bug, but it is really a suboptimal 
> implementation of a pretty important function as the example 
> below shows.
> 
> Now my questions are:
> 
> - any chance that the implementation can be changed in R 
> (suggested, well tz needs to be added)?
> - is there a better pure-R (no-C) way than that shown below 
> to convert to POSIXct?
> - any idea why in the example below fooling R into thinking a 
> list is POSIXlt is faster than just creating a POSIXlt by rep 
> or seq? It's not a huge difference, but still. Unfortunately 
> seq on POSIXlt returns POSIXct anyway, so the class of 
> 'origin' is set correctly.
> - any idea why seq is faster than rep when applied on 
> POSIXct? There is hardly anything simpler than on double values...
> 
> Thanks in advance for your comments,
> Oleg
> 
> It's common in finance to work with time stamps stored in a 
> form like %Y%m%d.%H%M%OS, e.g. 20080410.140444 for now, this 
> is what 'ts' in the example below is:
> 
> ts = 1e4*trunc(rnorm(5,2008,2)) + 1e2*trunc(runif(5,1,12)) + 
>  trunc(runif(5,1,28)) + 1e-2*trunc(runif(5,1,24)) +
>  1e-4*trunc(runif(5,1,60)) + 1e-6*runif(5,1,60)
> 
> posix.viaISOdate = function(x) {
> date = trunc([EMAIL PROTECTED])
> time = round([EMAIL PROTECTED],2)
> rtime = round(time)
> z = list(sec=rtime%%1e2 + time%%1,
> min=(rtime%/%1e2)%%1e2,
> hour=rtime%/%1e4,
> mday=date%%100,
> mon=(date%/%100)%%100,
> year=date%/%1)
> ISOdate(z$year,z$mon,z$mday,z$hour,z$min,z$sec) # to POSIXct }
> 
> ## This is just a test of how is it faster to create a long 
> POSIXlt object ## before another implementations are given
> 
> origin = as.POSIXct("1970-01-01") 
> 
> mean(sapply(1:25,function(i) system.time(
> as.POSIXlt(rep(origin,60))
> ))[1,])
> # [1] 0.3972
> 
> mean(sapply(1:25,function(i) system.time(
> as.POSIXlt(seq(origin, origin, length.out=60))
> ))[1,])
> # [1] 0.30528
> 
> 
> posix.viaPOSIXlt1 = function(x) {
> origin = as.POSIXct("1970-01-01") 
> z = as.POSIXlt(seq(origin, origin, length.out=length(x)))
> date = trunc([EMAIL PROTECTED])
> time = round([EMAIL PROTECTED],2)
> rtime = round(time)
> z$sec=rtime%%1e2 + time%%1
> z$min=(rtime%/%1e2)%%1e2
> z$hour=rtime%/%1e4
> z$mday=date%%100
> z$mon=(date%/%100)%%100-1
> z$year=date%/%1-1900
> as.double(z) # to POSIXct
> }
> 
> posix.vialist = function(x) {
> date = trunc([EMAIL PROTECTED])
> time = round([EMAIL PROTECTED],2)
> rtime = round(time)
> na = rep(0.0,length(x))
> z = list(sec=rtime%%1e2 + time%%1,
> min=(rtime%/%1e2)%%1e2,
> hour=rtime%/%1e4,
> mday=date%%100,
> mon=(date%/%100)%%100-1,
> year=date%/%1-1900,
> wday=na,yday=na,isdst=na)
> class(z) = c("POSIXt","POSIXlt")
> as.double(z) # to POSIXct
> }
> 
> v1 = posix.viaISOdate(ts)
> v2 = posix.viaPOSIXlt1(ts)
> v3 = posix.vialist(ts)
> 
> all(v1==v2 & v2==v3)
> # [1] TRUE
> 
> mean(sapply(1:25,function(i) system.time(
> system.time(posix.viaISOdate(ts))
> ))[1,])
> # [1] 1.54244
> 
> mean(sapply(1:25,function(i) system.time(
> system.time(posix.viaPOSIXlt1(ts))
> ))[1,])
> # [1] 0.37624
> 
> mean(sapply(1:25,function(i) system.time(
> system.time(posix.vialist(ts))
> ))[1,])
> # [1] 0.35488
> 
> 
> 
> 
> sessionInfo()
> R version 2.6.2 (2008-02-08)
> x86_64-unknown-linux-gnu
> 
> locale:
> LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLA
> TE=C;LC_MO
> NETARY=en_GB.UTF-8;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_ID
> ENTIFICATI
> ON=C
> 
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
> 
> loaded via a namespace (and not attached):
> [1] rcompgen_0.1-17
> 
> Dr Ol

Re: [Rd] coerce methods and inheritance

2008-04-10 Thread John Chambers
Hi John,
>
> John Chambers wrote:
>> Herve Pages wrote:
>>> Hi,
>>>
>>> It doesn't seem that the dispatching algo is finding my coerce 
>>> method under
>>> some circumstances.
>>> Let's say I have 2 classes, A and AA and that AA is just a direct 
>>> extension
>>> of A with no additional slots:
>>>
>>>setClass("A", representation(ii="integer"))
>>>setClass("AA", contains="A")
>>>
>>> I can define a method for coercing my objects to an integer vector 
>>> with:
>>>
>>>setAs("A", "integer", function(from) {cat("I'm the A->integer 
>>> coerce method\n"); [EMAIL PROTECTED])
>>>
>>> and this works as expected when my object is an AA instance:
>>>
>>>> aa <- new("AA", ii=sample(10, 5))
>>>> as(aa, "integer")
>>>I'm the A->integer coerce method
>>>[1] 10  1  6  4  7
>>>
>>> But things don't behave that way anymore if I introduce a direct 
>>> extension of AA:
>>>
>>>setClass("OrderedAA",
>>>  contains="AA",
>>>  validity=function(object)
>>>  {
>>>  if (!all(diff([EMAIL PROTECTED]) >= 0))
>>>  return("slot 'ii' is not ordered")
>>>  TRUE
>>>  }
>>>)
>>>
>>> and a method for coercing an A object to an OrderedAA object:
>>>
>>>setAs("A", "OrderedAA",
>>>  function(from)
>>>  {
>>>  cat("I'm the A->OrderedAA coerce method\n")
>>>  new("OrderedAA", ii=sort([EMAIL PROTECTED]))
>>>  }
>>>)
>>>
>>> My A->OrderedAA coerce method is not called anymore:
>>>
>>>> oaa <- as(aa, "OrderedAA")
>>>> oaa
>>>> validObject(oaa)
>>>Error in validObject(oaa) :
>>>  invalid class "OrderedAA" object: slot 'ii' is not ordered
>>>
>>> This looks like a bug to me.
>>>   
>> Well, obscure perhaps, and not as well documented as it might be.
>>
>> Defining a subclass of "AA" creates implicit coerce methods in both 
>> directions.  The method from "AA" to its subclass creates a new 
>> object from the subclass, then inserts the inherited slots.
>>
>>  > selectMethod("coerce", c("AA", "OrderedAA"))
>> Method Definition:
>>
>> function (from, to)
>> {
>>obj <- new("OrderedAA")
>>as(obj, "AA") <- from
>>obj
>> }
>
> The problem is that this implicit method doesn't seem to check the 
> validity
> of the new object. So now my users have an easy way to create broken 
> objects
> without being told that they are doing something wrong... unless I have
> redefined a lot of coerce methods in my software (and there can be a 
> lot of
> them).
> Unfortunately for me and my project, it looks like most of these 
> "implicit"
> methods are doing the wrong thing. So if the purpose of having them 
> was to
> make the developer's life easier, it doesn't work for me.
Yes, I understand that.  But does that mean that all other applications 
should NOT have the automatic replacement?  I'm not hugely committed to 
it but notice that the real issue is the underlying
  as(obj, "AA") <- from
which uses a replacement method generated for simple contained 
relationships.  Throwing that out to save you having to write a coerce 
method seems a little drastic.

The underlying assumption is that most classes are defined by the 
classes of their slots. Your example has extra, implicit requirements, 
which is fine but is not likely to come for free.
>
>>
>> Signatures:
>>from totarget  "AA" "OrderedAA"
>> defined "AA" "OrderedAA"
>>
>> The situation is made more confusing because these methods are only 
>> explicitly inserted in the coerce() function the first time they're 
>> used (for obvious efficiency reasons).
>
> Even worse, after I define my coerce method for A->OrderedAA, and 
> _before_
> I try to coerce my first AA object to an OrderedAA object, I get this:
>
>   > selectMethod("coerce", c("AA", "OrderedAA"))
>   Method Definition:
>
>   function (from, to = "OrderedAA", strict = TRUE)
>   {
> cat("I'm the A->OrderedAA coerce method\n")
> new("OrderedAA", ii = sort([EMAIL PROTECTED]))
>   }
>
>   Signatures:
>   from to
>   target  "AA" "OrderedAA"
>   defined "A"  "OrderedAA"
>
> which is not reporting the truth (the method that will actually be 
> selected
> will be the implicit one, not mine).
>
>>
>> Notice that this is a direct method, not an inherited one.  It will 
>> be chosen by the method selection from as().
>>
>> So it is true that if you want to override the implicit methods, you 
>> have to do that for each new subclass, presumably when defining the 
>> subclass.
>>
>>  >setAs("AA", "OrderedAA",
>> +  function(from)
>> +  {
>> +  cat("I'm the A->OrderedAA coerce method\n")
>> +  new("OrderedAA", ii=sor  [TRUNCATED]
>>  > as(aa, "OrderedAA")
>> I'm the A->OrderedAA coerce method
>> An object of class "OrderedAA"
>> Slot "ii":
>> [1]  4  5  7  8 10
>>
>> It's possible to argue that an inherited, explicitly defined method, 
>> as in your case, is worth more than a direct, implicitly defined method.
>
> It's definitely worth more than a direct, im

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

2008-04-10 Thread Patrick Aboyoun
Thanks Duncan,
I just did a survey of the BioConductor repository and only 4 of the 354 
.Rnw vignette files contain the \usepackage{Sweave} specification. 
Adding this is tedious, but not impossible. If the \usepackage{Sweave} 
specification does become recommended, could you add a WARNING to the R 
CMD build/check process if a vignette file lacks it? That would help 
steer developers in the right direction for cross-platform compatibility 
since most R package developers don't use Windows as their primary platform.


Cheers,
Patrick


Duncan Murdoch wrote:
> On 4/9/2008 9:50 PM, Patrick Aboyoun wrote:
>> I forgot to mention the BioConductor Windows build machine is running
>> Microsoft Windows Server 2003 R2
>> Enterprise Edition, SP2
>>
>> I just checked and this same problem exists if I place R in the 
>> standard "C:\Program Files\R" location on this machine.
>
> We're going to roll back that change, so you should be okay with your 
> original setup.  As far as I know there is no way to get MikTeX to 
> work if you have a space in your pathname, so putting R in the 
> standard location will fail, unless you follow the advice I give below.
>
>> For now the backup plan is to move to using short path names for 
>> BioConductor builds (modifying 100+ vignettes is impractical as well 
>> as configuring MiKTeX to handle multiple installs of R that the build 
>> machine uses). If there is an alternate configuration that I should 
>> be using, just let me know.
>
> I would recommend biting the bullet and adding \usepackage{Sweave} to 
> every vignette.  It's just a one line addition to them, and it will 
> mean that their .tex output will work if you move it to a different 
> machine, where the full path to Sweave.sty is different.
>
> Duncan Murdoch
>
>>
>>
>> Cheers,
>> Patrick
>>
>>
>> Duncan Murdoch wrote:
>>> On 09/04/2008 5:23 PM, Patrick Aboyoun wrote:
 Something funky happened to my e-mail. I was trying to paste 
 information related to MiKTeX and R into my message and it appears 
 to have corrupted the text somehow. Anyway, the message I was 
 trying to get across is that the tex file contains the path

 \usepackage{E:/paboyoun/BBS-2~1.2-B/R/share/texmf/Sweave}

 and MiKTeX 2.7 doesn't know how to resolve it. (The 
 Bioconductor.tex file is (hopefully) attached to this e-mail.)
>>>
>>> You should be able to get things to work by explicitly putting
>>>
>>> \usepackage{Sweave}
>>>
>>> somewhere early in your .Rnw file.  You may have trouble with MikTeX 
>>> finding Sweave.sty, depending how you invoke it:  if invoked from R 
>>> CMD it should work, but maybe not from your command line unless you 
>>> tell it where to look for include files.  How you do that changes 
>>> all the time; R tries a couple, which is why R CMD probably works.
>>>
>>> Duncan Murdoch
>>>


 === BEGIN OS BLOCK ===

 E:\paboyoun>pdflatex --version
 MiKTeX-pdfTeX 2.7.2987 (1.40.7) (MiKTeX 2.7)
 Copyright (C) 1982 D. E. Knuth, (C) 1996-2006 Han The Thanh
 TeX is a trademark of the American Mathematical Society.

 E:\paboyoun>pdflatex Bioconductor.tex
 This is pdfTeX, Version 3.141592-1.40.7 (MiKTeX 2.7)
 entering extended mode
 (Bioconductor.tex
 LaTeX2e <2005/12/01>
 Babel  and hyphenation patterns for english, dumylang, 
 nohyphenation, ge
 rman, ngerman, french, loaded.
 ("C:\Program Files\MiKTeX 2.7\tex\latex\base\article.cls"
 Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
 ("C:\Program Files\MiKTeX 2.7\tex\latex\base\size12.clo"))
 ("C:\Program Files\MiKTeX 2.7\tex\latex\psnfss\times.sty")
 ("C:\Program Files\MiKTeX 2.7\tex\latex\hyperref\hyperref.sty"
 ("C:\Program Files\MiKTeX 2.7\tex\latex\graphics\keyval.sty")
 ("C:\Program Files\MiKTeX 2.7\tex\latex\oberdiek\hycolor.sty")
 ("C:\Program Files\MiKTeX 2.7\tex\latex\hyperref\pd1enc.def")
 ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\etexcmds.sty"
 ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\infwarerr.sty"))
 ("C:\Program Files\MiKTeX 2.7\tex\latex\00miktex\hyperref.cfg")
 ("C:\Program Files\MiKTeX 2.7\tex\latex\oberdiek\kvoptions.sty")
 Implicit mode ON; LaTeX internals redefined
 ("C:\Program Files\MiKTeX 2.7\tex\latex\ltxmisc\url.sty")
 ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\bitset.sty"
 ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\intcalc.sty")
 ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\bigintcalc.sty"
 ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\pdftexcmds.sty")))
 ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\kvsetkeys.sty")
 ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\atbegshi.sty"
 ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\ifpdf.sty")))
 *hyperref using default driver hpdftex*
 ("C:\Program Files\MiKTeX 2.7\tex\latex\hyperref\hpdftex.def")
 ! Missing \endcsname inserted.
 

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

2008-04-10 Thread Duncan Murdoch
On 4/10/2008 1:18 PM, Patrick Aboyoun wrote:
> Thanks Duncan,
> I just did a survey of the BioConductor repository and only 4 of the 354 
> .Rnw vignette files contain the \usepackage{Sweave} specification. 
> Adding this is tedious, but not impossible. If the \usepackage{Sweave} 
> specification does become recommended, could you add a WARNING to the R 
> CMD build/check process if a vignette file lacks it? That would help 
> steer developers in the right direction for cross-platform compatibility 
> since most R package developers don't use Windows as their primary platform.

I think the Sweave default of inserting the path to Sweave.sty is the 
problem. I've checked my LaTeX books, and none of them mention this as a 
possiblity:  the argument of \usepackage is supposed to be a package 
name, not a path to a style file with the .sty chopped off.  Obviously 
some implementations support the syntax of using a path, but this is 
clearly not well supported:  there's no way I can see to specify 
perfectly legal paths, if they happen to contain characters that LaTeX 
thinks are special.

So I would say the direction we should move is for Sweave to insert just

\usepackage{Sweave}

(and possibly a comment saying where to go to find it, for people who 
don't know how to set up the include path properly).  But I wouldn't 
make a change like that at this late date for 2.7.0.

Duncan Murdoch


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

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

 \usepackage{Sweave}

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

 Duncan Murdoch

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

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

2008-04-10 Thread Prof Brian Ripley
I suggest that we try to program a solution in Sweave.  It only inserts 
the path to the file is stylepath=TRUE in RweaveLatexSetup, so it seems 
to be that

Sweave(stylepath=FALSE)

is all that is needed.  That seems to work, although of course obliges 
people to make sure Sweave.sty is in their latex input path (and using 
texi2dvi makes that rather hard).

Sweave is only used by R in three places, in 
tools:::.install_package_vignettes which is only used to build the grid 
vignettes, and tools::checkVignettes (used by R CMD check) and 
buildVignettes (used by R CMD build), and none of which pass any arguments 
to Sweave.

Here's a proposal.  Instead of making stylepath=TRUE the default, set its 
default from the environment variable _SWEAVE_STYLEPATH_DEFAULT_ . Then 
all Patrick needs to do is to set this to FALSE and ensure that his MiKTeX 
setup has Sweave.sty in a texmf tree.

That leaves the question of what the default should be if the environment 
variable is not set -- I suggest TRUE unless the path contains a space 
(since it doesn't currently work if it does and so is backwards 
compatible).

That seems well below the limits of what is acceptable at this point for 
2.7.0, so if reaction is favourable we should go ahead.

Brian Ripley

On Thu, 10 Apr 2008, Patrick Aboyoun wrote:

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

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

 \usepackage{Sweave}

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

 Duncan Murdoch

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

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

2008-04-10 Thread Kurt Hornik
> Prof Brian Ripley writes:

> I suggest that we try to program a solution in Sweave.  It only inserts 
> the path to the file is stylepath=TRUE in RweaveLatexSetup, so it seems 
> to be that

> Sweave(stylepath=FALSE)

> is all that is needed.  That seems to work, although of course obliges 
> people to make sure Sweave.sty is in their latex input path (and using 
> texi2dvi makes that rather hard).

Unless you do

  R CMD texi2dvi

as this will add the R share/texmf to TEXINPUTS.

> Sweave is only used by R in three places, in 
> tools:::.install_package_vignettes which is only used to build the grid 
> vignettes, and tools::checkVignettes (used by R CMD check) and 
> buildVignettes (used by R CMD build), and none of which pass any arguments 
> to Sweave.

> Here's a proposal.  Instead of making stylepath=TRUE the default, set its 
> default from the environment variable _SWEAVE_STYLEPATH_DEFAULT_ . Then 
> all Patrick needs to do is to set this to FALSE and ensure that his MiKTeX 
> setup has Sweave.sty in a texmf tree.

> That leaves the question of what the default should be if the environment 
> variable is not set -- I suggest TRUE unless the path contains a space 
> (since it doesn't currently work if it does and so is backwards 
> compatible).

> That seems well below the limits of what is acceptable at this point for 
> 2.7.0, so if reaction is favourable we should go ahead.

Personally, I always thought the default should be not to set the path
and suggest to use R CMD texi2dvi.

Best
-k

> Brian Ripley

> On Thu, 10 Apr 2008, Patrick Aboyoun wrote:

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

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

2008-04-10 Thread Prof Brian Ripley
On Thu, 10 Apr 2008, Kurt Hornik wrote:

>> Prof Brian Ripley writes:
>
>> I suggest that we try to program a solution in Sweave.  It only inserts
>> the path to the file is stylepath=TRUE in RweaveLatexSetup, so it seems
>> to be that
>
>> Sweave(stylepath=FALSE)
>
>> is all that is needed.  That seems to work, although of course obliges
>> people to make sure Sweave.sty is in their latex input path (and using
>> texi2dvi makes that rather hard).
>
> Unless you do
>
>  R CMD texi2dvi
>
> as this will add the R share/texmf to TEXINPUTS.

Unfortunately MiKTeX ignores TEXINPUTS and all such environment 
variables.  (I think MiKTeX 2.7 has a solution that was not in earlier 
versions, which is to use texi2dvi --include-directory, which we already 
use in doc/manual.)

>> Sweave is only used by R in three places, in
>> tools:::.install_package_vignettes which is only used to build the grid
>> vignettes, and tools::checkVignettes (used by R CMD check) and
>> buildVignettes (used by R CMD build), and none of which pass any arguments
>> to Sweave.
>
>> Here's a proposal.  Instead of making stylepath=TRUE the default, set its
>> default from the environment variable _SWEAVE_STYLEPATH_DEFAULT_ . Then
>> all Patrick needs to do is to set this to FALSE and ensure that his MiKTeX
>> setup has Sweave.sty in a texmf tree.
>
>> That leaves the question of what the default should be if the environment
>> variable is not set -- I suggest TRUE unless the path contains a space
>> (since it doesn't currently work if it does and so is backwards
>> compatible).
>
>> That seems well below the limits of what is acceptable at this point for
>> 2.7.0, so if reaction is favourable we should go ahead.
>
> Personally, I always thought the default should be not to set the path
> and suggest to use R CMD texi2dvi.
>
> Best
> -k
>
>> Brian Ripley
>
>> On Thu, 10 Apr 2008, Patrick Aboyoun wrote:
>
>>> Thanks Duncan,
>>> I just did a survey of the BioConductor repository and only 4 of the 354
>>> .Rnw vignette files contain the \usepackage{Sweave} specification.
>>> Adding this is tedious, but not impossible. If the \usepackage{Sweave}
>>> specification does become recommended, could you add a WARNING to the R
>>> CMD build/check process if a vignette file lacks it? That would help
>>> steer developers in the right direction for cross-platform compatibility
>>> since most R package developers don't use Windows as their primary platform.
>>>
>>>
>>> Cheers,
>>> Patrick
>>>
>>>
>>> Duncan Murdoch wrote:
 On 4/9/2008 9:50 PM, Patrick Aboyoun wrote:
> I forgot to mention the BioConductor Windows build machine is running
> Microsoft Windows Server 2003 R2
> Enterprise Edition, SP2
>
> I just checked and this same problem exists if I place R in the
> standard "C:\Program Files\R" location on this machine.

 We're going to roll back that change, so you should be okay with your
 original setup.  As far as I know there is no way to get MikTeX to
 work if you have a space in your pathname, so putting R in the
 standard location will fail, unless you follow the advice I give below.

> For now the backup plan is to move to using short path names for
> BioConductor builds (modifying 100+ vignettes is impractical as well
> as configuring MiKTeX to handle multiple installs of R that the build
> machine uses). If there is an alternate configuration that I should
> be using, just let me know.

 I would recommend biting the bullet and adding \usepackage{Sweave} to
 every vignette.  It's just a one line addition to them, and it will
 mean that their .tex output will work if you move it to a different
 machine, where the full path to Sweave.sty is different.

 Duncan Murdoch

>
>
> Cheers,
> Patrick
>
>
> Duncan Murdoch wrote:
>> On 09/04/2008 5:23 PM, Patrick Aboyoun wrote:
>> Something funky happened to my e-mail. I was trying to paste
>> information related to MiKTeX and R into my message and it appears
>> to have corrupted the text somehow. Anyway, the message I was
>> trying to get across is that the tex file contains the path
>>>
>> \usepackage{E:/paboyoun/BBS-2~1.2-B/R/share/texmf/Sweave}
>>>
>> and MiKTeX 2.7 doesn't know how to resolve it. (The
>> Bioconductor.tex file is (hopefully) attached to this e-mail.)
>>
>> You should be able to get things to work by explicitly putting
>>
>> \usepackage{Sweave}
>>
>> somewhere early in your .Rnw file.  You may have trouble with MikTeX
>> finding Sweave.sty, depending how you invoke it:  if invoked from R
>> CMD it should work, but maybe not from your command line unless you
>> tell it where to look for include files.  How you do that changes
>> all the time; R tries a couple, which is why R CMD probably works.
>>
>> Duncan Murdoch
>>
>>>
>>>
>> === BEGIN OS BLOCK ===
>>

[Rd] inconsistency within within( ) (PR#11131)

2008-04-10 Thread jritter
Hello R-team ~

I ran across an inconsistency about how within( ) handles expressions 
like b<-NULL.  (I have found within( ) very handy, by the way.)  The 
problem appears to crop up when you use something like b<-NULL in the 
same within() call that creates a new variable in the data frame.  An 
example using 2.6.2 on Windows XP is below.  Version 2.6.1 had a 
different, but similar problem.

As always, thanks for a very useful piece of software.

Joe Ritter

 > a<-1:5;b<-2:6;c<-3:7
 > abc=data.frame(a,b,c)
 > within(abc,{b<-NULL})
   a c
1 1 3
2 2 4
3 3 5
4 4 6
5 5 7
 > within(abc,{d<-a+7;b<-NULL})
   a cd structure(c(" 8", " 9", "10", "11", "12"), class = "AsIs")
1 1 3 NULL  8
2 2 4   9
3 3 5  10
4 4 6  11
5 5 7  12
Warning message:
In format.data.frame(x, digits = digits, na.encode = FALSE) :
   corrupt data frame: columns will be truncated or padded with NAs
 > within(abc,{a<-a+7;b<-NULL})
a c
1  8 3
2  9 4
3 10 5
4 11 6
5 12 7

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


Re: [Rd] autocompletion problem

2008-04-10 Thread Deepayan Sarkar
On 4/9/08, Herve Pages <[EMAIL PROTECTED]> wrote:

[...]

>  BTW are there any plans to deal with backquoted symbols/names?
>  There are currently 2 problems with this:
>
>   1. Completion will work and expand symbols or names that contain special
>  characters but without backquoting them:
>
>xxx <- as.list(11:13)
>names(xxx) <- letters[1:3]
>names(xxx)[2] <- "2b"
>
>> xxx$#  stands for a hit on the Tab key
>xxx$2b  xxx$a   xxx$c
>> xxx$2b# I hit 2, then  gives me the b
>
> Now if I hit , of course I get:
>
>Error: unexpected numeric constant in "xxx$2"
>
>   2. Completion of names after $ will not work if I've already backquoted
>  the partial name:
>
>> xxx$`2...  # nothing happens

1 will be hard to ``fix'' because of limitations in the various
backends (some of which are unable to insert text before the cursor).
Also, more checks will presumably slow things down, and it's not clear
that the benefits would be worth it.

2 might be doable; I'll look into it.

-Deepayan

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


[Rd] Re: library(forecast) (PR#11111)

2008-04-10 Thread ligges
The problem with tseries has been resolved for Win2k and R-2.6.x (as 
well as the one with Matrix), I hope. Please download a new version from 
CRAN master in roughly 12 hours from now (you have to wait for some 
syncing process before).

Uwe Ligges

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