Re: [Rd] R-uthreads?
On Thu, 3 Apr 2008, Andrew Piskorski wrote: > On Wed, Apr 02, 2008 at 11:58:34AM -0500, Luke Tierney wrote: >> Subject: Re: [Rd] callCC in 2.7.0 > >> Some of us worked on something along these lines a while back in a >> branch called R-uthreads, but the cost of converting to that >> approach and the overhead of maintaining it seemed too high for the >> benefit, at least at the time. > > Luke, could you say a bit more about R-uthreads, what your ideas, > goals, and conclusions there were? > > I see the old R-uthreads branch in svn (looks like it was based on R > 1.4 back in Aug. 2001), but I couldn't find any summary discussion, > and I can't tell much just from looking at "src/main/uthreads.c". > The primary objective was to provide user-level threads to help expressing concurrent computations, including some concurrent things already happening in R (running finalizers in gc, aspects of guis). The infrastructure would also be able to support one-shot (and maybe more general) continuations, generators, coroutines, and the like. The design was based on the same ideas as the stackless python project at the time, and maybe also the Concurrent Haskell project -- moving stuff that is currently on the C stack into data structures allocated on the R heap and arranging for computations to be done from a single eval call rather than a set of nested eval calls. That way it is easy to suspend the state of the current computation so it can be resumed later. The uthreads.c file only contains the interface for threading, as I recall -- the major work is in the other files, like eval. The implementation was complete enough to run some very simple threading examples, though I don't seem to have any code examples handy. The effort needed to make this work is fairly high. Some was done fairly completely (moving contexts into the R heap for example), but changing functions that use nested eval calls into ones that do some processing and return a deferred version of the next task to a top-level eval was only partially done as I recall. (I also don't think we dealt with the issue of serializing continuations.) Doing this would have been a lot of work, as would convincing everyone who needed to be convinced that this was a good idea and needed to be maintained. In addition, there are some things, like optim's callbacks for example, that really are not suitable for this kind of rewriting. This isn't necessarily fatal -- in the threading context it would just mean that no context switches can occur while within such a callback, but it makes things messy. The basic approach may still be viable, and it has the benefit of being fully portable, unlike stack copying tricks. But given other things that needed to be done at the time, the need for fairly pervasive changes as well as a change in the way of thinking about R internals, the benefits of continuing down this route at the time didn't seem to outweigh the costs. Best, luke -- Luke Tierney Chair, Statistics and Actuarial Science Ralph E. Wareham Professor of Mathematical Sciences University of Iowa Phone: 319-335-3386 Department of Statistics andFax: 319-335-3017 Actuarial Science 241 Schaeffer Hall email: [EMAIL PROTECTED] Iowa City, IA 52242 WWW: http://www.stat.uiowa.edu __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] getNativeSymbolInfo fails with Fortran symbol.
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
[Rd] coerce methods and inheritance
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. Thanks, H. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Windows problem related to using shortPathName for Sweave style file
In the process of updating R to R 2.7 alpha or R 2.7 beta for the BioConductor 2.2 builds on Windows, I have hit a snag because the BioC build system has long path names (e.g. D:\biocbld\bbs-2.2-bioc\R) and these path names are not resolving properly by MiKTeX 2.7 during vignette construction. Take, for example, the attached vignette from Biobase, Bioconductor.Rnw. I have built R from source at E:\paboyoun\bbs-2.2-bioc\R and the session information for this R is === BEGIN R BLOCK === > sessionInfo() R version 2.7.0 beta (2008-04-09 r45179) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base === END R BLOCK === Now when I run Sweave on Bioconductor.Rnw using the command === BEGIN OS BLOCK === E:\paboyoun>bbs-2.2-bioc\R\bin\R CMD Sweave Bioconductor.Rnw Writing to file Bioconductor.tex Processing code chunks ... 1 : term tex You can now run LaTeX on 'Bioconductor.tex' % % NOTE -- ONLY EDIT THE .Rnw FILE!!! The .tex file is % likely to be overwritten. % %\VignetteIndexEntry{Bioconductor Overview} %\VignetteDepends{} %\VignetteKeywords{Documentation} %\VignettePackage{Biobase} \documentclass[12pt]{article} \usepackage{times} \usepackage{hyperref} \textwidth=6.2in \textheight=8.5in %\parskip=.3cm \oddsidemargin=.1in \evensidemargin=.1in \headheight=-.3in \newcommand{\scscst}{\scriptscriptstyle} \newcommand{\scst}{\scriptstyle} \bibliographystyle{plainnat} \begin{document} \title{What is Bioconductor} \maketitle \section*{Prequisites} Bioconductor is a project to develop innovative software tools for use in computational biology. It is based on the R language ({\url www.r-project.org}). You should already be quite familiar with R before using Bioconductor. There are several on--line resources that can help you get started using R. They can be found from the R website. Some users find this a very steep learning curve; your experience may be similar. Bioconductor packages provide flexible interactive tools for carrying out a number of different computational tasks. They are generally not as fast as other analysis tools (since they are interactive) and often reflect current ideas. Most can be improved and interested users should file bug reports and feature requests on the Bioconductor mailing list. Bioconductor welcome collaboration in many different forms. These include new packages, fixes or additions to existing packages and help on different projects that are currently underway. Please see the {\em Current Projects} web page to see if there are any projects that are intersting to you. \subsection*{How to report a bug} Please provide enough information for us to help you. This typically includes the platform (windows, Unix, Macintosh) that you are using as well as version numbers for R and for the package that seems to be working incorrectly. Include a small complete example that can be run and demonstrates the problem. In some cases it is also important that you describe what you thought you should get. Please note: \begin{itemize} \item bugs in R should be reported to the R community \item missing features are not bugs -- they are feature requests. \end{itemize} \section{Bioconductor Design} Bioconductor relies on the R package system to distribute code and data. Most packages use S4 methods and classes (as described in {\em Programming with Data} by J. M. Chambers). This adherence to object oriented programming makes it easier to build component software and helps to deal with the complexity of the data. One of the important Bioconductor packages is {\em annotate}. This package provides access to various genomic annotation data. This package makes use of various web resources and precompiled data packages to provide tools for exploring biological data. \section{Session Information} The version number of R and packages loaded for generating the vignette were: \begin{verbatim} <>= sessionInfo() @ \end{verbatim} \end{document} __ 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
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.) === 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
[Rd] autocompletion problem
Hi, Let's create the xxx object just to avoid confusion even if it's not necessary for reproducing the problem below: xxx <- 8:3 If I start typing this: max(xxx[ and now try to autocomplete with , then I get the following error (and a warning): > max(xxx[Error in grep(sprintf("^%s", makeRegexpSafe(text)), allArgs, value = TRUE) : invalid regular expression '^xxx[' In addition: Warning message: In grep(sprintf("^%s", makeRegexpSafe(text)), allArgs, value = TRUE) : regcomp error: 'Invalid regular expression' Now it seems that this problem in R has managed to screw up something out of R (and this is probably OS dependent, I'm running 64-bit openSUSE 10.3) because when I quit R and try to do something at the shell level, what I type is not echoed anymore in the terminal window. For example if I type 'whoami' followed by , here is what I get on the screen (only the output of the command is displayed but not the command itself): [EMAIL PROTECTED]:~> hpages I've tried this with other R versions (2.6.1, 2.6.2) on other Linux flavors (64-bit openSUSE 10.1, 32-bit openSUSE 10.3, 32-bit Ubuntu 6.06) and got almost the same thing, the only difference being that with older versions of R (e.g. with 2.7.0 from 2007-12-09 r43632), I get the error message but no additional warning. Cheers, H. > sessionInfo() R version 2.7.0 beta (2008-04-07 r45159) x86_64-unknown-linux-gnu locale: LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] coerce methods and inheritance
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 } Signatures: from to target "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). 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. But whether this would be true in all applications is not obvious. But that the documentation needs to spell this out--no question. Thanks for bringing it up. John > Thanks, > H. > > __ > 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] autocompletion problem
On 4/9/08, Herve Pages <[EMAIL PROTECTED]> wrote: > Hi, > > Let's create the xxx object just to avoid confusion even if it's not > necessary > for reproducing the problem below: > >xxx <- 8:3 > > If I start typing this: > >max(xxx[ > > and now try to autocomplete with , then I get the following error (and > a warning): > >> max(xxx[Error in grep(sprintf("^%s", makeRegexpSafe(text)), allArgs, > value = TRUE) : > invalid regular expression '^xxx[' >In addition: Warning message: >In grep(sprintf("^%s", makeRegexpSafe(text)), allArgs, value = TRUE) : > regcomp error: 'Invalid regular expression' Thanks for the report, makeRegexpSafe was not escaping "[". Does the following workaround fix the problem (without introducing additional ones)? assignInNamespace("makeRegexpSafe", ns = "utils", value = function(s) { s <- gsub(".", "\\.", s, fixed = TRUE) s <- gsub("?", "\\?", s, fixed = TRUE) s <- gsub("[", "\\[", s, fixed = TRUE) s <- gsub("]", "\\]", s, fixed = TRUE) # necessary? s }) (with 2.6.x, replace "utils" with "rcompgen") -Deepayan __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] autocompletion problem
Herve Pages wrote: > Hi, > > Let's create the xxx object just to avoid confusion even if it's not necessary > for reproducing the problem below: > >xxx <- 8:3 > > If I start typing this: > >max(xxx[ > > and now try to autocomplete with , then I get the following error (and a > warning): > >> max(xxx[Error in grep(sprintf("^%s", makeRegexpSafe(text)), allArgs, > value = TRUE) : > invalid regular expression '^xxx[' >In addition: Warning message: >In grep(sprintf("^%s", makeRegexpSafe(text)), allArgs, value = TRUE) : > regcomp error: 'Invalid regular expression' > > Hmm, looks like makeRegexpSafe(text)) isn't. Presumably, it should escape [ along with . and ? > Now it seems that this problem in R has managed to screw up something out of > R (and > this is probably OS dependent, I'm running 64-bit openSUSE 10.3) because when > I quit > R and try to do something at the shell level, what I type is not echoed > anymore in > the terminal window. Yes it happens occasionally (not just with R) that you come back to the shell level with tty settings out of whack. The pragmatic fix is to blind-type the command stty sane followed by (or ctrl-J if you are paranoid). > For example if I type 'whoami' followed by , here is what > I get on the screen (only the output of the command is displayed but not the > command > itself): > >[EMAIL PROTECTED]:~> hpages > > I've tried this with other R versions (2.6.1, 2.6.2) on other Linux flavors > (64-bit > openSUSE 10.1, 32-bit openSUSE 10.3, 32-bit Ubuntu 6.06) and got almost the > same thing, > the only difference being that with older versions of R (e.g. with 2.7.0 from > 2007-12-09 > r43632), I get the error message but no additional warning. > > Cheers, > H. > > > > sessionInfo() > R version 2.7.0 beta (2008-04-07 r45159) > x86_64-unknown-linux-gnu > > locale: > LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > -- O__ Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Windows problem related to using shortPathName for Sweave style file
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
Re: [Rd] autocompletion problem
Hi Deepayan, Deepayan Sarkar wrote: > On 4/9/08, Herve Pages <[EMAIL PROTECTED]> wrote: >> Hi, >> >> Let's create the xxx object just to avoid confusion even if it's not >> necessary >> for reproducing the problem below: >> >>xxx <- 8:3 >> >> If I start typing this: >> >>max(xxx[ >> >> and now try to autocomplete with , then I get the following error (and >> a warning): >> >>> max(xxx[Error in grep(sprintf("^%s", makeRegexpSafe(text)), allArgs, >> value = TRUE) : >> invalid regular expression '^xxx[' >>In addition: Warning message: >>In grep(sprintf("^%s", makeRegexpSafe(text)), allArgs, value = TRUE) : >> regcomp error: 'Invalid regular expression' > > Thanks for the report, makeRegexpSafe was not escaping "[". Does the > following workaround fix the problem (without introducing additional > ones)? > > assignInNamespace("makeRegexpSafe", ns = "utils", value = function(s) > { > s <- gsub(".", "\\.", s, fixed = TRUE) > s <- gsub("?", "\\?", s, fixed = TRUE) > s <- gsub("[", "\\[", s, fixed = TRUE) > s <- gsub("]", "\\]", s, fixed = TRUE) # necessary? > s > }) Yes this fixes the problem. Thanks! 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 Thanks! H. > > (with 2.6.x, replace "utils" with "rcompgen") > > -Deepayan > __ 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
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. 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. 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
Re: [Rd] coerce methods and inheritance
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. > > 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, implicitly defined method that produces invalid objects ;-) Anyway I can see why it can be nice (and save some efforts to the developer) to have a coercion mechanism that works out-of-the-box, but I'm wondering whether this is that useful to have implicit coerce methods in _both_ directions. It seems to me that, most of the times, the parent-to-child direction will do the wrong thing, because, generally speaking, you need some extra information (the extra slots) to coerce from the parent class to the child class. Thanks for the clarification! H. > But whether this would be true in all applications is not obvious. > > But that the documentation needs to spell this out--no question. Thanks > for bringing it up. > > John > > >> Than