Rev 3786 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
Note: This file hasn't been updated in quite a while. We'll be looking into*real* bug-tracking systems which should make it obsolete. -pdUpdate: We now have the bug-tracking system, but need to walk through thelist and see if anything here is still relevant.THE R TASK LIST``Somebody, somebody has to, you see ...''The Cat in the Hat Comes Back.----------------------------------------------------------------------TASK: Multiple Graphics Device DriversSTATUS: OpenFROM: EveryoneR needs to have multiple active device drivers and a means forcopying pictures from one device to another, etc. etc.[ This is a medium-sized task. It would be most useful to ][ do this in conjunction with moving to an event driven model. ][ Greg Warnes has written some code which maintains, a device ][ "display list". How much memory this might devour in the ][ multiple device case is an open question. There is also ][ the question of what to do about the graphics parameters. ][ Should each device maintain a complete "par" state, or ][ should some parameters (like col, lty, font ...) be global. ][ Could a user have any memory of the last values in effect ][ for a driver which had been idle for a while. ][ This is just about to hit the top of the list. ]----------------------------------------------------------------------TASK: complex gamma and log gamma function not implementedSTATUS: OpenFROM: R@stat.auckland.ac.nz[ This is quite low priority. Complain if you need it. ][ The Fullerton library has complex gamma function code. ]----------------------------------------------------------------------TASK: solution of complex linear systemsSTATUS: OpenFROM: R@stat.auckland.ac.nz[ Really just a matter of grabbing the correct linpack code. ][ How general do we want to be here ... ]----------------------------------------------------------------------TASK: "nlm" documentation inaccuraciesSTATUS: OpenFROM: jlindsey@luc.ac.beThe help for nlm is still called minimize although thecontents have been updated. As well, when an illegalvalue is fed to nlm, the error message contains msginstead of print.level.[ The documentation looks ok. The function needs to be ][ rewritten so that it uses derivative information. ]----------------------------------------------------------------------TASK: "data.entry" problemsSTATUS: OpenFROM: p.dalgaard@kubism.ku.dkthe as.character problem in de() - probably better to fix eventhough it does make lists out of frames.there's no way to change a data value to NA in data.entry, etc.... earlier message ...(Peter Dalgaard) data.entry et al do not seem to have beenadjusted for the new data frame structure. This is actuallya problem where a list is passed where a vector of characterstrings is expected. To fix it changesnames <- substitute(list(...))[-1]tosnames <- as.character(substitute(list(...))[-1])However, there needs to be a look at the de... code. Whena data frame is edited it is returned as a list. This canbe cured with judicious use of "data.frame".[ The indicated change has been made, but other changes ][ are needed. ]----------------------------------------------------------------------TASK: "x11" printcmdSTATUS: OpenFROM: maechler@stat.math.ethz.chThere is in theory a "printcmd" argument to x11, whichis ignored. Make it do something.----------------------------------------------------------------------TASK: "source" requires a terminating newline on EOFSTATUS: OpenFROM: Kurt.Hornik@ci.tuwien.ac.atsource() fails in many cases where a file has no finalnewline. (R&R, sorry for being ridiculouly nasty aboutthings that don't work for files without a final newline.I have Emacs' next-line-add-newlines set to nil ...)This seems to be a problem with parse() in src/main/source.cin combo with the code in gram.y ...I know this is NOT something to quickly fix over the weekend.Please simply put it into your PROJECTS file.[ This is actually a syntax error according to the R grammar ][ but maybe we can do something. ]----------------------------------------------------------------------TASK: help file ALIAS() and LINK() constructionsSTATUS: ClosedFROM: R@stat.auckland.ac.nzHow do we know which file to LINK to? There needs to a stepwhich fills in the file name on the basis of all ALIASdeclarations.[ A proprocessing step is needed. First we build a table ][ of aliases and corresponding file names. Then we pass ][ throught the files building the correct LINK references. ][ The new Rdconv and build-html... solve `everything' ]----------------------------------------------------------------------TASK: "paste" problemSTATUS: ClosedFROM: maechler@stat.math.ethz.chin S,paste(....., collapse = string)always returns ONE string (a character vector of length 1),according to documentation and several examples.in R, this is not true:R> paste(rep(" ",0), collapse="...") #anything for collapsecharacter(0)S> paste(rep(" ",0), collapse="...") #anything for collapse[1] ""Again, I think R is more logical than S here, but it was decidedthat in minor cases, compatibility comes first...[ We now return "" in the zero length case. ]----------------------------------------------------------------------TASK: missing functionality - modellingSTATUS: OpenFROM: maechler@stat.math.ethz.chaov, print.aov, summary.aov,... (!)which I really missed for teaching a few months ago.[ We'll get to this - it actually should be fun. ]----------------------------------------------------------------------TASK: warnings optionSTATUS: OpenFROM: maechler@stat.math.ethz.chwhich reminds me that we/I also would like something similar as S'soptions(warn = k)k= 0 : [default] print warningsk= -1 : do nothing (maybe append warnings to some temp-file)k= 1 : produce an error ('warning' becomes 'stop').----------------------------------------------------------------------TASK: R has no stderrSTATUS: OpenFROM: Friedrich.Leisch@ci.tuwien.ac.atWhen I invoke R likeR 2>errlogI would error messages expect to go to the file errloginstead of the screen.[ We don't have standard error. This is problematic on ][ platforms other than Unix.----------------------------------------------------------------------TASK: "print.default" fixSTATUS: OpenFROM: la-jassine@aix.pacwan.netWhen you fix print.default, please also add prefix=----------------------------------------------------------------------TASK: "print.default" fixSTATUS: OpenFROM: jlindsey@luc.ac.beprint.default in S has an option, right=T, but R does not----------------------------------------------------------------------TASK: "postscript" fixSTATUS: OpenFROM: la-jassine@aix.pacwan.netpostscript() also needs the options onefile, print.it, andappend (even if they are not supported yet it would be nice ifthe arguments could be accepted and ignored).[ I added these as arguments, but they have no effect. ]----------------------------------------------------------------------TASK: task schedulingSTATUS: OpenFROM: gwhite@cabot.bio.dfo.caMore generally, the range of things that can be done in R wouldbe greater if there was a simple scheduling mechanism. Isthere a way to have a specific function invoked just before thecommand prompt returns after a function? Such a function couldbe used to run save(...) or check for various external cues(update of a file's timestamp) to control an analysis.I doubt it would make sense to have full context switching inR, but perhaps save() could be done in a way that would allowit to be used even in a long calculation under some timercontrol. I expect the user would need to provide a list of thedata objects that need to be saved.----------------------------------------------------------------------TASK: Inf numericsSTATUS: ClosedFROM: plummer@iarc.frCould we have an Inf object in R? I would find it useful.[ On systems using IEEE arithmetic, the builtin Inf and NaN ][ values are recognised and used as of 0.62. ]----------------------------------------------------------------------TASK: Auto-saveSTATUS: ClosedFROM: <p.dalgaard@kubism.ku.dk> <hornik@ci.tuwien.ac.at>> BTW: How about putting auto-save-workspace on the task list?> Or just a manual save.work() currently, you can lose quite a> bit of work to an unexpected segfault. (And q()+restart is> cumbersome, esp. if you need to reattach subsetted dataframes,> etc.)Perhaps call it save.image() instead and usesave(list = ls(), file = ".RData")as was suggested some time ago?(Whatever the result is, it needs to go in the FAQ, which goesinto great length about that under R data can get lost when acrash occurs, but does not say how to save them ...)[ Added save.image() as above. And yes, it's been in the FAQ ][ for quite some time now ... ]----------------------------------------------------------------------TASK: "chisquare.test" problemSTATUS: ClosedFROM: <venkat@biosta.mskcc.org>Can you change the explicit "cat" statement in the"chisquare.test" function which insists on writing to thescreen even when the output is redirected to a variable? (Using"htest" class as in "t.test" function.)[ Replaced by chisq.test(), formerly in the ctest package, ][ which properly returns an object of class "htest". ]----------------------------------------------------------------------TASK: Graphics inconsistenciesSTATUS: ClosedFROM: Bill.Venables@adelaide.edu.auWhile transferring some old S-code I came across some minorinconsistencies between R and S that are probably more nuisancevalue than they would take to fix. I report them here forreference, (but not in any campaigning mood, of course...)1. No frame() command in R and so no graceful way to clear aplotting screen. (Or is there?)[ Added ]2. There is a dev.off() function, but no other dev.xxx functions.(The dev.xxx group are S-PLUS and not vanilla S, by the way.)There is no graphics.off() function.[ Added in 0.62. ]3. If dfr is a data frame with components "x", "y" and someothers then points(dfr) uses dfr as an xy-list in S but not inR. If there is some non-numeric component it actually failsin R. This may be S being a bit inconsistent, but thebehaviour is different.[ Fixed? ]4. The plotting marks are a bit gappy in R and even the onesthat are there do not correspond to their S counterparts.Here is a little function to make a wall chart showing thegaps:[ We now have all the S symbols and a new set of R ones. ]show.marks <- function(){if(!exists(".Device") || is.null(.Device)) x11()plot(1, type="n", axes=F, xlab="", ylab="")oldpar <- par()par(usr = c(-0.01, 5.01, -0.01, 5.01), pty = "s")for(i in 0:18) {x <- 1/2 + (i %% 5)y <- 4.5 - (1/2 + (i %/% 5))points(x + 1/5, y - 1/5, pch = i, cex = 3)text(x - 1/5, y + 1/5, i, adj = 0.5, cex = 1.5)}abline(h = 1:5 - 0.5, lty = 1)segments(0:5, rep(0.5, 5), 0:5, rep(4.5, 5))par(oldpar)invisible()}5. In S you may extend a list by assigning to a new component.For example if lis has components "x" and "y", only, you canextend it by assigning to lis$z, lis["z"] or lis[, "z] (thelast if it is also a data frame). In R only the first ofthese works; the others give a "subscript out of bounds"error. (This may have been discussed while I was not payingattention, in which case I apologize.)[ Fixed in 0.50. ]----------------------------------------------------------------------TASK: Function pointer accessSTATUS: OpenFROM: <schwarte@feat.mathematik.uni-essen.de>I want to report two problems with the Fortran code of R.1) Configure does not adapt GETSYMBOLS.in if the Fortran Compilerdoes not add underscores to the symbol names.2) There is a name conflict if the Fortran Compiler does not addunderscores because there exist a Fortran function FMIN and aC function fmin(). Thus the name of the Fortran FMIN should bechanged.[ This is fixed I think. ]Currently I am rewriting my robust location-scale code in C. Iintend to make this new code available as a library once astandard for such libraries has been agreed upon. As I wouldlike to allow prospective users to experiment with privatepsi/chi functions I need access to the hash table of availablefunction pointers. Is it possible that you insert a functioninto dotcode.c that contains the code fragment form lines 482to 495 and returns a function pointer?----------------------------------------------------------------------TASK: Partial string matchingSTATUS: OpenFROM: <R@stat.auckland.ac.nz>Is there an existing partial string match function which couldbe used in place of pstrmatch in subset.c???If not can pstrmatch take on the functions of all partial matchfunctions?----------------------------------------------------------------------Post 0.49 Additions----------------------------------------------------------------------TASK: Name Attributes on CallsSTATUS: Closed (almost)FROM: <p.dalgaard@kubism.ku.dk>A call with tagged arguments is something like a list, the tagscan be used to access elements, but the names attribute is absent,until the call is coerced to a list. (Attempting to set the names()causes evaluation. Changing "list" to "blipblop" causes an 'Error:couldn't find function "blipblop"' at that point.)> j<-substitute(list(a=1, b=2))> jlist(a = 1, b = 2)> j$b[1] 2> names(j)NULL> names(j)<-NULL> j[[1]][1] 1[[2]][1] 2[At least under SunOS this is fixed. RG][However, 'names(j) <- NULL' has no effect in R, but does in S. MM]----------------------------------------------------------------------TASK: String NAs Via the Back Door.STATUS: OpenFROM: <p.dalgaard@kubism.ku.dk>Ok, the right solution seems to be names(as.list(j)), but then we runinto some other fun with NA's... Shouldn't the real NA print withoutquotes?> ch[1]<-paste("N","A",sep="")> is.na(ch)[1] FALSE FALSE FALSE> ch[1] "NA" "a" "b"> ch[1]=="NA"[1] TRUE> ch[1]<-"NA"> is.na(ch)[1] TRUE FALSE FALSE[ We need a real NA. At present there is confusion between ][ the string "NA" and the NA value for strings. One solution ][ would be to use R_NilValue to indicate the missing string ][ value, and let NA be just an ordinary string in all cases. ][ This would be incompatible with S, but still an improvement. ]----------------------------------------------------------------------TASK: Directory StructureSTATUS: ClosedFROM: <Kurt.Hornik@ci.tuwien.ac.at> + Friedrich + Paul Gilbert> Regarding the location of data for libraries it might be easier if> everything for one library is included in one subdirectory. At least> it would certainly be easier to clean-up, which I like to do every few> years. Thus the code file, data, and any compiled code would be in> one subdirectory under $RHOME/library.Likelibrary/<section>/library/<section>/datalibrary/<section>/exec (scripts and or binaries whichonly make sense for the add-on)library/<section>/funslibrary/<section>/helplibrary/<section>/htmllibrary/<section>/objs (*.so)???> I realize this means a small change to the way libraries are now> found, but in the end I think it would be much cleaner.I think the changes would not be too hard, and we need to do somethingabout the directory structure anyway.Actually, I think if R&R ok'ed something like that, Fritz and I wouldtake a look.(In a way, I NEED to do something like that anyway, because I promisedit for making an official Debian package ...)Would it mean that we also employ the S library/section concept?----------------------------------------------------------------------TASK: Startup ProcessingSTATUS: OpenFROM: <p.dalgaard@kubism.ku.dk>The x11() window can be a nuisance to have popping up at startup (esp.on small screens) when you're not working with graphics. However,currently you can't get rid of it without modifying the systemwideRprofile.Current logic is:Run $RHOME/library/Rprofileif ./.Rprofile existsrun itelse if $HOME/.Rprofile existsrun thatendifI think it should beRun $RHOME/library/Rsetupif ./.Rprofile existsrun itelse if $HOME/.Rprofile existsrun thatelse if $RHOME/library/Rprofile existsrun thatendifi.e. essential system initialisation goes in Rsetup, the rest inRprofile, which can be overridden by the user. Currently, the lineif(interactive()) x11()is the candidate to move from one to the other. BTW, it really should readif(interactive() && getenv("DISPLAY")!="") x11()[BTW2: getenv() implemented using system()? is that really necessary?]>> <Kurt.Hornik@ci.tuwien.ac.at>I more or less agree, BUT:I'd like (in the future) to have the system-wide Rprofile searched in asite-specific location as well (similar to Emacs, following the idea ofkeeping the distribution and the site-specific things apart).So it would besystem-wide Rsetup (which should basically be platform-specificstuff, cause otherwise it could go into base as well?)if .Rprofile exists run it elseif ~/.Rprofile exists run it elseif Rprofile exists on the default library search path, run itand that search path could e.g. specify all `library' trees with acompile-time default of~/lib/R:/usr/local/lib/R/site:/usr/local/lib/R/${version}and settable at run time via e.g. the environment variable R_PATH.----------------------------------------------------------------------TASK: Old Unfixed ProblemsSTATUS: ClosedFROM: <Kurt.Hornik@ci.tuwien.ac.at>I noticed the following problems (all already reported, but not inTASKS).* File permissions in data should be 644.* In src/unix/system.c, one `Rdata' should be `RData' (d -> D).* The documentation for the noncentral chisquare distribution isnot quite correct. (rnchisq does not exist, the existingfunctions have x, df and the noncentrality parameter as args,and the density should be pnchisq(x, df, lambda)= exp(-lambda / 2)* sum_{r=0}^\infty \frac{lambda^r}{2^r r!} pchisq(x, df + 2r)(semiTeX notation only, sorry).[ All fixed now. ]----------------------------------------------------------------------TASK: New ProblemsSTATUS: ClosedFROM: <Kurt.Hornik@ci.tuwien.ac.at>New minor remarks:* The documentation for `image' still has the old order z, x, y.* Perhaps one should add `par(ask = T)' in the image demo?* Perhaps one should save the original value of par() at thebeginning of the graphics demo, and restore that at its end(s.t. typically asking is turned off again).----------------------------------------------------------------------TASK: Multiplatform SupportSTATUS: OpenFROM: <warnes@biostat.washington.edu>I've modified the "$RHOME/bin/R" and "$RHOME/cmd/filename" so that youcan use the same directories for multiple machines. That is, machinesrunning various flavors of UNIX can access the same directories.The modified structure adds the directories$RHOME/bin/$OSTYPE/$RHOME/lib/$OSTYPE/to hold the machine specific binaries.For instance, here the $RHOME directory contains two subdirectories,$RHOME/bin/solaris/$RHOME/bin/sunos4/which each hold the appropriate R.binary file.These two modified functions assume that the environmentvariable $OSTYPE is appropriately set, as is done automaticallyby the shell tcsh. If it is not set, the directory namescollapse to the original values,$RHOME/bin/ and $RHOME/lib/To use them, create the approprate directories and place thecorrect binaries therein. ( Note that the makefiles will not dothis automatically!) Then replace $RHOME/bin/R and$RHOME/cmd/filename with the modified ones.----------------------------------------------------------------------TASK: Platform IndependenceSTATUS: OpenFROM: Friedrich.Leisch@ci.tuwien.ac.atIMHO we should definetely have platform-dirs for everything that'spossibly platform-dependent ... resulting in something like<library>/<section>/<type>e.g. for R code and<library>/<section>/<type>/<platform>e.g. for exec and dynload-objects.for exec there's a problem though, as some exec's areshell/perl/whatever-scripts and *should* work on any platform...----------------------------------------------------------------------TASK: PolySTATUS: OpenFROM: <Kurt.Hornik@ci.tuwien.ac.at>PS1. There was also `poly' function in your snapshot WORK tree... do you already have a final version of that?----------------------------------------------------------------------TASK: Naming with Numeric Values and "unlist"STATUS: ClosedFROM: <hornik@ci.tuwien.ac.at>R> l <- list("11" = 1:5)R> l$11[1] 1 2 3 4 5R> unlist(l)111 112 113 114 1151 2 3 4 5[ The same as S does, hence determined a feature ]----------------------------------------------------------------------TASK: all.names neededSTATUS: ClosedFROM: <bates@stat.wisc.edu>I could not find the all.names function in R so I created theenclosed. Comments, criticisms, or changes to a one-liner bycreating nested anonymous functions are welcome. I'll try towork out a corresponding all.vars function.[ all.names() and all.vars() added in 0.61. ]----------------------------------------------------------------------TASK: "sys.function" problemSTATUS: OpenFROM: <bates@stat.wisc.edu>I attempted to create a recursive anonymous function to be calledwithin another function. You may want to stop reading for a bit andconsider how that would be done. That is, how do you recursively calla function that has never been assigned a name?OK, you're back. You probably came up with a better solution than Idid but I used (sys.function())(arg) to do the recursion. The pieceof code looks likeflist <- (function(x) {if (mode(x) == "call") {if (x[[1]] == as.name("/"))return(c(sys.function()(x[[2]]), sys.function()(x[[3]])))if (x[[1]] == as.name("(")) # for Rreturn(sys.function()(x[[2]]))}if (mode(x) == "(") return(sys.function()(x[[2]])) # for Slist(x)})(getGroupsFormula(data, form, ...)[[2]])## I know it's horribly obscure. Blame Bill Venables for teaching me this.Regretably, it doesn't work in R. Using the debugger one finds thatsys.function() returns the function being called the first timethrough but the second time through it returns NULL. Is this a bug ora feature?----------------------------------------------------------------------TASK: "update" comments and fixesSTATUS: OpenFROM: <thomas@biostat.washington.edu>1. To make update() work with a new formula for glms, change thefirst line of the glm() function fromcall <- sys.call(tocall<-match.call()(this means that the formula component of the returned call islabelled so that update can find it)2. update.lm doesn't do anything with its weights= argumentAddif (!missing(weights))call$weights<-substitute(weights)Similarly, to get update to work properly on glms you need a lotmore of these if statements (see update.glm at the end of the message).3. update.lm evaluates its arguments in the wrong frame.It creates a modified version of the original call and evaluatesit in sys.frame(sys.parent()). If update.lm is called directlythis is correct, but if it is called via update() the correctframe is sys.frame(sys.parent(2)). Worse still, if it is calledby NextMethod() from another update.foo() the correct frame isstill higher up the list.My solution (a bit ugly) is to move up the list of enclosing callschecking at each stage to see if the call is NextMethod, update or anupdate method. It can be seen at the end of update.glm at the bottom ofthis message, and something of this sort needs to be added to other updatemethods.update.glm<-function (glm.obj, formula, data, weights, subset,na.action, offset, family, x){call <- glm.obj$callif (!missing(formula))call$formula <- update.formula(call$formula, formula)if (!missing(data))call$data <- substitute(data)if (!missing(subset))call$subset <- substitute(subset)if (!missing(na.action))call$na.action <- substitute(na.action)if (!missing(weights))call$weights <- substitute(weights)if (!missing(offset))call$offset <- substitute(offset)if (!missing(family))call$family <- substitute(family)if (!missing(x))call$x <- substitute(x)notparent <- c("NextMethod", "update", methods(update))for (i in 1:(1+sys.parent())) {parent <- sys.call(-i)[[1]]if (is.null(parent))breakif (is.na(match(as.character(parent), notparent)))break}eval(call, sys.frame(-i))}----------------------------------------------------------------------TASK: WisdomSTATUS: OpenFROM: <bates@stat.wisc.edu>Some of the "eternal truths" about the S language are:- every object has a mode obtainable by mode(object) [ok]- every object has a length obtainable by length(object) [ok]- every object can be coerced to a list of the same length[not yet, even for expression()s(and functions)]One can imagine that code that messes around with functions andother expressions in R will break fairly quickly when theseconditions do not hold. I don't know how much work would beinvolved in patching over these differences between R and Sbut I suspect it would not be a trivial undertaking.----------------------------------------------------------------------TASK: frametoolsSTATUS: OpenFROM: <p.dalgaard@kubism.ku.dk>The following three functions are designed to make manipulation ofdataframes easier. I won't write detailed docs just now, but if youfollow the example below, you should get the general picture. Commentsare welcome, esp. re. naming conventions.Note that these functions are definitely not portable to S becausethey rely on R's scoping rules. Not that difficult to fix, though: Thenm vector and the "parsing" functions need to get assigned to(evaluation) frame 1 (the "expression frame" of S), and preferablyremoved at exit.data(airquality)aq<-airquality[1:10,]select.frame(aq,Ozone:Temp)subset.frame(aq,Ozone>20)modify.frame(aq,ratio=Ozone/Temp)Notice that in modify.frame(), any *new* variable must appear as atag, not as the result of an assignment, i.e.:modify.frame(aq,Ozone<-log(Ozone)) works as expectedmodify.frame(aq,lOzone<-log(Ozone)) does not.This is mainly because it was tricky to figure out what part of a lefthand side constitutes a new variable to be created (note that indexingcould be involved). So assignments to non-existing variables justcreate them as local variables within the function. Making a virtueout of necessity, that might actually be considered a feature...----------------------------------------"select.frame" <-function (dfr, ...){subst.call <- function(e) {if (length(e) > 1)for (i in 2:length(e)) e[[i]] <- subst.expr(e[[i]])e}subst.expr <- function(e) {if (is.call(e))subst.call(e)else match.expr(e)}match.expr <- function(e) {n <- match(as.character(e), nm)if (is.na(n))eelse n}nm <- names(dfr)e <- substitute(c(...))dfr[, eval(subst.expr(e))]}"modify.frame" <-function (dfr, ...){nm <- names(dfr)e <- substitute(list(...))if (length(e) < 2)return(dfr)subst.call <- function(e) {if (length(e) > 1)for (i in 2:length(e)) e[[i]] <- subst.expr(e[[i]])substitute(e)}subst.expr <- function(e) {if (is.call(e))subst.call(e)else match.expr(e)}match.expr <- function(e) {if (is.na(n <- match(as.character(e), nm)))if (is.atomic(e))eelse substitute(e)else substitute(dfr[, n])}tags <- names(as.list(e))for (i in 2:length(e)) {ee <- subst.expr(e[[i]])r <- eval(ee)if (!is.na(tags[i])) {if (is.na(n <- match(as.character(tags[i]),nm))) {n <- length(nm) + 1dfr[[n]] <- numeric(nrow(dfr))names(dfr)[n] <- tags[i]nm <- names(dfr)}dfr[[tags[i]]][] <- r}}dfr}"subset.frame" <-function (dfr, expr){nm <- names(dfr)e <- substitute(expr)subst.call <- function(e) {if (length(e) > 1)for (i in 2:length(e)) e[[i]] <- subst.expr(e[[i]])e}subst.expr <- function(e) {if (is.call(e))subst.call(e)else match.expr(e)}match.expr <- function(e) {if (is.na(n <- match(as.character(e), nm)))eelse dfr[, n]}r <- eval(subst.expr(e))r <- r & !is.na(r)dfr[r, ]}----------------------------------------------------------------------TASK: General ProblemsSTATUS: OpenFROM: <jlindsey@luc.ac.be>1. A gentle reminder that the default has not been changed for saving.RData in batch mode (as was promised).2. The degrees of freedom for the null deviance in glm are wrong whensome observations are weighted out. This can give silly answers, forexample when applying anova. The number of weighted out observationsshould be subtracted, as in other df calculations.3. The null deviance itself is wrong in glm when an offset is used. Itcan be smaller than that when variables are added to the model!4. R gave a segmentation fault when I tried to fit a model with 49factor levels in glm (using R -v4). All these glm problems were withpoisson.5. R still does not read my environmental variables to set memorysize.Suggestions:1. d, p, q, and r functions for inverse Gauss and Laplacedistributions.2. Add a fifth function for continuous distributions, the hazardfunction, h. For example, ht <- function(...) dt(...)/(1-pt(...))is the Student t hazard function.For writing likelihood functions, these would be much faster in C thanR and some such as Weibull can be simplified.3. Add the five functions for three parameter distributions such asgeneralized F, extreme value, etc., Box-Cox,... (I have the densities,cumulative, and hazard as R functions.)4. Philippe Lambert and I have d and p functions working in R for thefour-parameter stable family by inverting the characteristic functionwith a Fourier transform (requires C code). S-plus only has the rfunction for stables.----------------------------------------------------------------------TASK: Generic PrintSTATUS: OpenFROM: Paul Gilbert <la-jassine@aix.pacwan.net>I have always thought that typing the name of an object generateda call to the print method for the object, however, (in 0.49)I redefined the generic print method asprint <- function(x, ...){if (is.tframe(x)) UseMethod("print.tframe")else UseMethod("print")}Now I have an object z which returns TRUE to is.tframe(z) and> class(z)[1] "ts" "tframe"Then> print(z)[1] 1981.50 2006.25 4.00But> zError: comparison is possible only for vector types> traceback()[1] "c(\"print.ts(structure(c(1981.5, 2006.25, 4), class = c(\\\"ts\\\",\\\"tframe\\\"\", "[2] "c(\"print(structure(c(1981.5, 2006.25, 4), class = c(\\\"ts\\\",\\\"tframe\\\"\", "This is generating a call to the class method print.tsrather than to print.tframe.ts as is done when I useprint(z). If my understanding that typing the name of anobject should generate a call to the print method for theobject then this is a bug. Otherwise, could someone pleaseexplain to me what it does. Thanks.----------------------------------------------------------------------TASK: getenv()STATUS: ClosedFROM: Paul Gilbert <la-jassine@aix.pacwan.net>Here are two small problems I've pointed out before, but stillseem to be in 0.49.1/ getenv() should return everything, not complain missing item.[ Fixed now. In fact, at least under Unix getenv() now returns ][ the whole environment, as in S. ]----------------------------------------------------------------------TASK: summary.defaultSTATUS: ClosedFROM: Paul Gilbert <la-jassine@aix.pacwan.net>2/ In summary.default...sumry[i, 2] <- if (is.object(ii))class(ii)should be changed to...sumry[i, 2] <- if (is.object(ii))paste(class(ii), collapse=" ")so that it works with lists of lists. (This fix was suppose to beadded to Splus 4.)[The solution is now different:cls <- class(ii)sumry[i, 2] <- if (length(cls) > 0) cls[1] else "-none-"]----------------------------------------------------------------------TASK: Time Series ProblemsSTATUS: OpenFROM: <la-jassine@aix.pacwan.net>Here are four problems with ts:1/ ts matrix subscripting should support drop=F:> z<- matrix(1:10,5,2)> z <-ts(z)> z[,1,drop=F]Error in [.ts(z, , 1, drop = F) : unused argument to function[ok]2/ == and other comparisons with non-ts matrices should work:> z <- matrix( 1:10,5,2)> ts(z)Time-Series:Start = c(1, 1)End = c(5, 1)Frequency = 1[,1] [,2][1,] 1 6[2,] 2 7[3,] 3 8[4,] 4 9[5,] 5 10> z == ts(z)Error: invalid time series parameters specified3/ The generic functions start and end need default methods toreturn a result for matrices as previously and in S. Thefollowing seems to work.start.default <- function (x) start(ts(x))end.default <- function (x) end(ts(x))[ Added ]4/ In the function start.ts (and in end.ts) ts[1] in the last lineis not defined. Perhaps I am missing something?start.tsfunction (x){ts.eps <- .Options$ts.epsif (is.null(ts.eps))ts.eps <- 1e-06tsp <- attr(as.ts(x), "tsp")is <- tsp[1] * tsp[3]if (abs(is - round(is)) < ts.eps) {is <- floor(tsp[1])fs <- floor(tsp[3] * (tsp[1] - is) + 0.001)c(is, fs + 1)}else ts[1]}[ Fixed ]----------------------------------------------------------------------TASK: Recycling problemsSTATUS: OpenFROM: Paul Gilbert <la-jassine@aix.pacwan.net>In R 0.49 comparison of logic matrices with & and | seemsto sometimes generate false warning messages about longerobject length is not a multiple of shorter object length.I have not been able to isolate the exact circumstances.----------------------------------------------------------------------TASK: Generic "write" functionSTATUS: OpenFROM: <Kurt.Hornik@ci.tuwien.ac.at>Following my posting of a write.table() function, Martinsuggested that one could have a generic write() functionand special methods for e.g. time series, data frames, etc.Well, a month has passed since ...What does everyone think? Is it a good idea, or wouldwrite.table() be enough? If we think that it is not enough,which arguments should the write methods typically allow?What aboutwrite.xxx (x, # objectfile = # filename, default stdoutappend = # obvioussep = # obviouseol = # end of line char...)???On the other hand, it seems clear that something likewrite.table() is nice, and what it should do. But whatabout classes other than data.frame?Note that S has a write(.) function which would be ourwrite.default(.)your write.table would be ourwrite.data.frameThe only addition would be a 'write.matrix' which would be 'like'write.data.frame, the only problem being that 'matrix' is not a class(yet).[Note that in S4, everything has a class;I'm voting for matrices to have a class in R ..]write.default could 'despatch' to write.matrix if x is a matrix.----------------------------------------------------------------------TASK: Comparison with NA and Zero-Length VectorsSTATUS: OpenFROM: <thomas@biostat.washington.edu> + <maechler@stat.math.ethz.ch>Thomas: Any comparison with NULL generates an errorError: comparison is possible only for vector typeswhereas in S(-PLUS) it gives NA, which seems more sensible.Along similar lines, comparison with a length 0 vectorreturns logical(0) in R but NA in S.Martin: Isn't logical(0) more logical than NA ?I agree that it would be best (convenience)if 'NULL==1' returned the same as 'numeric(0)==1'.At the moment, I don't see why compatibility with S should beimportant here:if( NULL == anything)or, e.g., if( numeric(0) == numeric(0) )give an error anyway, i.e., you have to test for length 0 _anyway_in the cases where one comparison argument may have zero length.Thomas: I didn't (previously) make any comment on this --I only said that NA was more logical than an error message.However, the advantage of returning NA is that NA | TRUEis TRUE, NA & FALSE is FALSE, which doesn't happen withlogical(0). Also, from a compatibility point of view oneof them is tested with is.na(), the other with length(),so it can matter which one you use. Of course no-one shoulddeliberately write code where it matters, but these thingshappen.It seems in fact that logical(0) | TRUE causes R to freeze(R0.49, sparc solaris).Robert: Well, we thoughtlogical(0) & T should return logical(0)logical(0) | T should return logical(0)already we have NA | T returns T and NA & T returns NA----------------------------------------------------------------------TASK: ModulesSTATUS: OpenFROM: <luke@stat.umn.edu>I came across a paper on scheme module design that may beunder consideration for rnrs -- I'm a bit hazy on that. Atany rate, it is at http://www.cs.princeton.edu/~blume/modules.dvi.I haven't read it carefully yet, but it is fairly heavilyinfluenced by SML but doesn't go too far overboard (wellmaybe a bit).----------------------------------------------------------------------May 1.----------------------------------------------------------------------TASK: "abline" incompatibilitySTATUS: Closed; Fixed uncertain why.... (Aug 6, 97).FROM: <nobu@psrc.isac.co.jp>I found a little different behavior of R with S.at R-0.49:> a[1] 12 23 22 34 44 54 55 70 78> plot(a)> abline(lsfit(seq(1,len=length(a)), a))Error: no applicable method for "coefficients"at S (from AT&T '92) result draw coefficient line without error.Then I think to need define a function as followed:coefficients.default <- function(x) x$coef----------------------------------------------------------------------TASK: Legend problemsSTATUS: OpenFROM: <jlindsey@luc.ac.be>When legend is used, the box around it has the line-typeof the last call to lines or plot instead of solid always.----------------------------------------------------------------------TASK: "rnorm" changeSTATUS: OpenFROM: Paul Gilbert <la-jassine@aix.pacwan.net>For some reason I cannot determine, the function rnormseems to be returning different values in R 0.49 than itdid in R 0.16.1 (in Linux ELF). The function runif isunchanged.[ I believe I changed the underlying generator. ][ I was worried about behavior in the extreme tails. ][ Should we change back again? ]----------------------------------------------------------------------TASK: "formula" problemsSTATUS: OpenFROM: <mikem@stat.cmu.edu>Several bugs (no solutions, yet). These might be well known.1) If one does, e.g., mymod <- lm(y ~ x); formula(mymod)then one does not get back the formula (one gets,Error: invalid formula)CLOSED (Aug 6, 97, RG).2) if x is of mode numeric, then the model formulamymod <- lm(y ~ x + x^2)is not processed as S would do it. The model is fitignoring the x^2 term, however mymod$call includes the x^2term. This seems to be a bug (or maybe feature) in applyingmodel formulae operators to numeric quantities. I expect(from experience with S) that x^2 will be interpreted asa math operator. Whatever the right thing to do is, itneeds to be documented.----------------------------------------------------------------------TASK: formula problemsSTATUS: OpenFROM: <p.dalgaard@kubism.ku.dk>Mike Meyer <mikem@stat.cmu.edu> writes:> Several bugs (no solutions, yet). These might be well known.> 1) If one does, e.g., mymod <- lm(y ~ x); formula(mymod)> then one does not get back the formula (one gets, Error: invalid formula)Yep. Seems that we need aformula.lm<-function(x)formula(x$terms)> 2) if x is of mode numeric, then the model formula> mymod <- lm(y ~ x + x^2)> is not processed as S would do it. The model is fit ignoring the x^2 term,We had that topic a while back. I think it was concludedthat it is a feature, because mixing model formulas andarithmetic ditto is bad practice. (I don't have any strongfeeling about this, personally. As long as R won't introducethose awful Helmert contrasts as default...)----------------------------------------------------------------------TASK: formula problemsSTATUS: OpenFROM: <wvenable@attunga.stats.adelaide.edu.au>Peter Dalgaard writes:> >> > 2) if x is of mode numeric, then the model formula> > mymod <- lm(y ~ x + x^2)> > is not processed as S would do it. The model is fit[ted]> > ignoring the x^2 term...>> We had that topic a while back. I think it was concluded that> it is a feature, because mixing model formulas and arithmetic> ditto is bad practice.I don't recall we did, but in any case I'd like to re-open it.There is an anomaly in the way : and ^ terms are handled in thesense that the logical and useful thing is obvious but does nothappen. Let me give an example. Suppose a and b are factors, xand y are not.A term such as (a + b + x + y)^2 should be expanded out binomialfashion, coefficients stripped away and the remaining productstreated as : products. Then S copes with terms like a:a, a:b anda:x fine, even x:y is handled by having it generate a column ofxy-products, as it should.But a term such as x:x does not generate a column of x-squares,it is merely removed as it would be if it were a factor. This isa complete anomaly, and one that I don't think would be hard ordangerous for R to rectify. Indeed it would be very useful togenerate a complete second degree regression in three variablesusing y ~ (1 + x1 + x2 + x3)^2. As it is now it generates linearand product terms only and omits the powers. Go figure.> (I don't have any strong feeling about this, personally. As> long as R won't introduce those awful Helmert contrasts as> default...)Ah, the Helmert contrasts b\^ete noir. For ANOVA the contrastmatrix used is mostly irrelevant. For regression models I agree,treatment contrasts would be generally more easily interpreted.I presume the reason they were used at all is because if you haveequal replication of everything the Helmert contrasts give you amodel matrix with orthogonal columns, so all estimates areuncorrelated. Whenever do you get equal replication, though?----------------------------------------------------------------------TASK: formula problemsSTATUS: OpenFROM: <p.dalgaard@kubism.ku.dk>Bill Venables <wvenable@attunga.stats.adelaide.edu.au> writes:> A term such as (a + b + x + y)^2 should be expanded out binomial> fashion, coefficients stripped away and the remaining products> treated as : products. Then S copes with terms like a:a, a:b and> a:x fine, even x:y is handled by having it generate a column of> xy-products, as it should.I tend to agree.> Ah, the Helmert contrasts b\^ete noir. For ANOVA the contrast> matrix used is mostly irrelevant. For regression models I agree,> treatment contrasts would be generally more easily interpreted.Understatement of the year... Last time I bumped into them, it took meand a colleague more than an hour to figure out how to interpret theregression coefficients, and, I may add, the solution was *not* whatthe white book said it was (it's not just one level minus the averageof the preceding, the parameter is also scaled by the reciprocal ofthe level number). [There's a split-second solution -- see below --but we sort of didn't think of it at the time...]> I presume the reason they were used at all is because if you have> equal replication of everything the Helmert contrasts give you a> model matrix with orthogonal columns, so all estimates are> uncorrelated. Whenever do you get equal replication, though?Hardly ever. Actually, I though that the point was not so muchortogonality, but the successive testing (A=B, A=B=C, A=B=C=D,...).However that is just plainly wrong outside of balanced ANOVA's.And, even in that case, once the first two levels differ, the restof the coefficients lose all meaning.----------------------------------------------------------------------TASK: formula problemsSTATUS: OpenFROM: <thomas@biostat.washington.edu>We also need to fix formula.default. At the moment it onlylooks for x$formula. Other standard places to keep aformula are x$call$formula and x$terms. How aboutformula.default<-function (x){if (!is.null(x$formula))return(eval(x$formula))if (!is.null(x$call$formula))return(eval(x$call$formula))if (!is.null(x$terms))return(x$terms)switch(typeof(x), NULL = structure(NULL, class = "formula"),character = formula(eval(parse(text = x)[[1]])),call = eval(x), stop("invalid formula"))}One disdvantage to extracting the formula from $termsinstead of $call$formula is that in S a terms object isnot a formula. On the other hand it doesn't really matteras long as people use the formula() function.----------------------------------------------------------------------TASK: formula problemsSTATUS: Open <Bill's code does work with 0.5a1>FROM: <wvenable@attunga.stats.adelaide.edu.au>Peter Dalgaard writes:> Bill Venables <wvenable@attunga.stats.adelaide.edu.au> writes:> > Ah, the Helmert contrasts b\^ete noir. For ANOVA the contrast> > matrix used is mostly irrelevant. For regression models I agree,> > treatment contrasts would be generally more easily interpreted.> Understatement of the year... Last time I bumped into them, it took me> and a colleague more than an hour to figure out how to interpret the> regression coefficients, and, I may add, the solution was *not* what> the white book said it was (it's not just one level minus the average> of the preceding, the parameter is also scaled by the reciprocal of> the level number). [There's a split-second solution -- see below --> but we sort of didn't think of it at the time...]A few weeks ago I gave a fairly detailed discussion of how torelate contrast matrices and their interpretation in s-news. Icould re-issue it or post it to people if that was their wish.There is also to be an extended discussion of the subject in V&R2due out in July, with a further elaboration to appear (real soonnow...) in the online complements.> > I presume the reason they were used at all is because if you have> > equal replication of everything the Helmert contrasts give you a> > model matrix with orthogonal columns, so all estimates are> > uncorrelated. Whenever do you get equal replication, though?>> Hardly ever. Actually, I though that the point was not so much> ortogonality, but the successive testing (A=B, A=B=C, A=B=C=D,...).> However that is just plainly wrong outside of balanced ANOVA's.> And, even in that case, once the first two levels differ, the rest> of the coefficients lose all meaning.Indeed. That's why I tended to discount that possibility myself.Here is a contrast matrix generator I sometimes prefer to usethat corresponds to testing A=B, B=C, C=D, ... Of course thecontrasts are not mutually orthogonal. How it works is left as alittle puzzle. (This function works in S. I haven't tested itin R, but it should work if lower.tri() is available.)contr.sdif <- function(n, contrasts = T){# contrasts generator giving `successive difference' contrasts.if(is.numeric(n) && length(n) == 1) {if(n %% 1 || n < 2)stop("invalid number of levels")lab <- as.character(seq(n))}else {lab <- as.character(n)n <- length(n)if(n < 2)stop("invalid number of levels")}if(contrasts) {contr <- col(matrix(nrow = n, ncol = n - 1))upper.tri <- !lower.tri(contr)contr[upper.tri] <- contr[upper.tri] - nstructure(contr/n, dimnames = list(lab, paste(lab[-1], lab[ - n], sep = "-")))}else structure(diag(n), dimnames = list(lab, lab))}> contr.sdif(4)2-1 3-2 4-31 -0.75 -0.5 -0.252 0.25 -0.5 -0.253 0.25 0.5 -0.254 0.25 0.5 0.75----------------------------------------------------------------------TASK: startup processingSTATUS: OpenFROM: <mikem@stat.cmu.edu>2) Again, along the lines of something that S does that isactually useful. In S you can set the S_FIRST environmentvariable and have this used as the equivalent of the R.Rprofile file. Might it be a good idea to allow anR_FIRST environment variable as well. That way I couldset user specific preferences that apply no matter whatdirectory I have working in.----------------------------------------------------------------------TASK: Function Argument NamingSTATUS: OpenFROM: <maechler@stat.math.ethz.ch>There is a problem with 'default argument evaluation'when I use an existing function name as argument name :sintest <- function(x, y = 2, sin= sin(pi/4)){## Purpose: Test of "default argument evaluation"## -------- Fails for R-0.49. Martin Maechler, Date: 9 May 97.c(x=x, y=y, sin=sin)}## R-0.49:R> sintest(1)##> Error in sintest(1) : recursive default argument reference## S-plus 3.4 (being 100% ok):S> sintest(1)x y sin1 2 0.7071068Warning messages:looking for function "sin", ignored local non-function in: sintest(1)-------------------------------------------------------The following shows bugs, both in R and S:sintest2 <- function(x ,y = 2){## Purpose: Test of "default argument evaluation"## -------- Fails for S-plus 3.4. Martin Maechler, Date: 9 May 97.c(x=x, y=y, sin=sin)}R> sintest2(1)[[1]][1] 1[[2]][1] 2[[3]]<primitive: sin>--------------- is almost okay,the buglet being that the names have been dropped from the list.But watch this:S> sintest2(1)function(x = 1, y = 2, sin.x)sin2 = .Internal(sin(x), "do_math", T, 109)--- returning a function((now we see, why S's way of treating functions aslists sometimes badly sucks)).----------------------------------------------------------------------TASK: Function argument namingSTATUS: OpenFROM: <luke@stat.umn.edu>Martin Maechler wrote:[ Stuff above. ]For better or worse, S and R allow default expressions tocontain references variables that are (or rather may be)created in the function body, so (in R and Splus)> x<-1> f<-function(a,b=x) { if (a) x<-2; b}> f()Error: Argument "a" is missing, with no default> f(T)[1] 2> f(F)[1] 1More traditional lexical scoping would make the referenceto x in the default always be global, but lots of codewould break. I think we're stuck with this behavior as acorollary to the way S wants default arguments to work.Actually S is a bit inconsistent in its error message --if you have a non-function argument it gives the samemessage as R,> g<-function(x=x) x>g()Error in g(): Recursive occurrence of default argument "x"DumpedAlso in R's lexical scoping you probably do want the argumentname to shadow any outer definitions if you want to be ableto define default arguments that are recursive functions,e.g.> g<-function(n, nfac=function(x) {if (x <= 1) 1 else nfac(x-1)*x }) nfac(n);> g(6)[1] 720----------------------------------------------------------------------TASK: Adding List Elements by NameSTATUS: OpenFROM: <p.dalgaard@kubism.ku.dk>This works in Splus:> x<-list()> x[["f"]]<-1> zz<-"g"> x[[zz]]<-2In R both variants fail unless the name is already on thelist. The first one can be replaced by x$f, but there'sseems to be no substitute for the other one (oh yes I foundone, but it's not fit to print!). This comes up if you e.g.want to create a variable in a data frame with a name givenby a character string.----------------------------------------------------------------------TASK: Bug in "approx"STATUS: OpenFROM:When the function approx is called with the argument rule=2, one getsthe error messageError: NAs in foreign function call (arg 6)Besides, the meaning of rule=1 or rule=2 is opposite to that describedin the help text and used in S-plus.For example, in R:R> approx(1:10,2:11,xout=5:15,rule=1)$x[1] 5 6 7 8 9 10 11 12 13 14 15$y[1] 6 7 8 9 10 11 11 11 11 11 11R> approx(1:10,2:11,xout=5:15,rule=2)Error: NAs in foreign function call (arg 6)but in S-plus:> approx(1:10,2:11,xout=5:15,rule=1)$x:[1] 5 6 7 8 9 10 11 12 13 14 15$y:[1] 6 7 8 9 10 11 NA NA NA NA NA> approx(1:10,2:11,xout=5:15,rule=2)$x:[1] 5 6 7 8 9 10 11 12 13 14 15$y:[1] 6 7 8 9 10 11 11 11 11 11 11The reason for this bug can be found in the last lines of the code ofapprox:if (rule == 1) {low <- y[1]high <- y[length(x)]}else if (rule == 2) {low <- NAhigh <- low}else stop("invalid extrapolation rule in approx")y <- .C("approx", as.double(x), as.double(y), length(x),xout = as.double(xout), length(xout), as.double(low),as.double(high))$xoutreturn(list(x = xout, y = y))If (rule == 2) the values of low and high are set to NA. Immediatelyafterwards, the foreign function "approx" is called with these values,leading to the errorError: NAs in foreign function call (arg 6)To obtain the same behavior as in S-plus (and as in the help-text) thecommands for (rule == 1) and (rule == 2) have to be exchanged.----------------------------------------------------------------------TASK: Matrix multiply problemsSTATUS: OpenFROM: <thomas@biostat.washington.edu>Both of these used to work and seem useful and harmless:R> matrix(1,ncol=1)%*%c(1,2)Error in matrix(1, ncol = 1) %*% c(1, 2) : non-conformable argumentsR> matrix(1,ncol=1)*(1:2)Error: dim<- length of dims do not match the length of object----------------------------------------------------------------------TASK: "write" functionSTATUS: Open?FROM: <Kurt.Hornik@ci.tuwien.ac.at>Following my posting of a write.table() function, Martinsuggested that one could have a generic write() functionand special methods for e.g. time series, data frames, etc.Well, a month has passed since ...What does everyone think? Is it a good idea, or wouldwrite.table() be enough? If we think that it is not enough,which arguments should the write methods typically allow?What aboutwrite.xxx (x, # objectfile = # filename, default stdoutappend = # obvioussep = # obviouseol = # end of line char...)???On the other hand, it seems clear that something likewrite.table() is nice, and what it should do. But whatabout classes other than data.frame?Martin Maechler:Note that S has a write(.) function which would be ourwrite.default(.)your write.table would be ourwrite.data.frameThe only addition would be a 'write.matrix' which would be 'like'write.data.frame, the only problem being that 'matrix' is not aclass (yet). [Note that in S4, everything has a class;I'm voting for matrices to have a class in R ..]write.default could 'despatch' to write.matrix if x is a matrix.----------------------------------------------------------------------TASK: "ls.print" problemSTATUS: Closed, Aug 6, 97 RG.<summary does what it should as does ls.print now>FROM: <VENKAT@biosta.mskcc.org>ls.print produces error that I don't seem to be able totrace. Output of the commands as follows: (hyeung is a24x2 matrix of data)-------------------------------------------------> summary(hyeung)x.1 x.2Min. : 28.0 Min. : 10.01st Qu.: 72.0 1st Qu.: 87.5Median : 86.5 Median : 92.5Mean : 81.0 Mean : 82.53rd Qu.: 97.0 3rd Qu.:100.0Max. :100.0 Max. :100.0> summary(lsfit(hyeung[,1],hyeung[,2]))Length Class Modecoef 2 -none- numericresiduals 24 -none- numericintercept 1 -none- logicalqr 6 -none- list> ls.print(lsfit(hyeung[,1],hyeung[,2]))trace: ls.print(lsfit(hyeung[, 1], hyeung[, 2]))Error: missing value in ``n1 : n2''----------------------------------------------------------------------TASK: Comparisons with zero length thingsSTATUS: OpenFROM: <thomas@biostat.washington.edu><maechler@stat.math.ethz.ch>Thomas:Any comparison with NULL generates an errorError: comparison is possible only for vector typeswhereas in S(-PLUS) it gives NA, which seems more sensible.Along similar lines, comparison with a length 0 vector returnslogical(0) in R but NA in S.Martin:Isn't logical(0) more logical than NA ?I agree that it would be best (convenience)if 'NULL==1' returned the same as 'numeric(0)==1'.At the moment, I don't see why compatibility with S should beimportant here:if( NULL == anything)or, e.g., if( numeric(0) == numeric(0) )give an error anyway, i.e., you have to test for length 0_anyway_ in the cases where one comparison argument mayhave zero length.Thomas:I didn't (previously) make any comment on this -- I onlysaid that NA was more logical than an error message.However, the advantage of returning NA is that NA | TRUEis TRUE, NA & FALSE is FALSE, which doesn't happen withlogical(0). Also, from a compatibility point of view oneof them is tested with is.na(), the other with length(),so it can matter which one you use. Of course no-one shoulddeliberately write code where it matters, but these thingshappen.It seems in fact that logical(0) | TRUE causes R to freeze(R0.49, sparc solaris).Robert:Well, we thoughtlogical(0) & T should return logical(0)logical(0) | T should return logical(0)already we have NA | T returns Tand NA & T returns NAMartin:Ok, given the above argument, returning NA is logical, too.However, I'd also argue thatlogical(0) | TRUE -> TRUElogical(0) & FALSE -> FALSElogical(0) & TRUE -> logical(0)logical(0) | FALSE -> logical(0)ThLu> It seems in fact that logical(0) | TRUE causes R to freezeThLu> (R0.49, sparc solaris).Yes:> logical(0) | TRUEWarning in logical(0) | TRUE : longer object lengthis not a multiple of shorter object lengthFloating exception~~~~~~~~~~~~~~~~~~ [and 'core' dump]----------------------------------------------------------------------TASK: Method lookup for "print"STATUS: OpenFROM: <la-jassine@aix.pacwan.net>I have always thought that typing the name of an objectgenerated a call to the print method for the object, however,(in 0.49) I redefined the generic print method asprint <- function(x, ...){if (is.tframe(x)) UseMethod("print.tframe")else UseMethod("print")}Now I have an object z which returns TRUE to is.tframe(z) and> class(z)[1] "ts" "tframe"Then> print(z)[1] 1981.50 2006.25 4.00But> zError: comparison is possible only for vector types> traceback()[1] "c(\"print.ts(structure(c(1981.5, 2006.25, 4), class = c(\\\"ts\\\",\\\"tframe\\\"\", "[2] "c(\"print(structure(c(1981.5, 2006.25, 4), class = c(\\\"ts\\\",\\\"tframe\\\"\", "This is generating a call to the class method print.tsrather than to print.tframe.ts as is done when I useprint(z). If my understanding that typing the name of anobject should generate a call to the print method for theobject then this is a bug. Otherwise, could someone pleaseexplain to me what it does. Thanks.----------------------------------------------------------------------TASK: False warningsSTATUS: OpenFROM: <la-jassine@aix.pacwan.net>In R 0.49 comparison of logic matrices with & and | seemsto sometimes generate false warning messages about longerobject length is not a multiple of shorter object length.I have not been able to isolate the exact circumstances.----------------------------------------------------------------------TASK: ISO-latin1 charactersSTATUS: OpenFROM: <maechler@stat.math.ethz.ch>There seems to be a problem in print.default with someISO-latin1 characters (the chars AFTER ASCII in westernEurope...) if they appear in strings. (no problem if theyare part of a function comment, see below).Some of the characters lead to 4 character Hex-codes beingprinted instead: "" ## ^u prints as "0xFB"If you use the funny characters in comments of functions,they are stored and printed properly.HOWEVER: In a few rare cases, the strings are not evenPARSED properly; the line 'ISOdiv <- ..' below gives aSYNTAX error.The following code shows the symptoms :-- ONLY if the e-mail between here and your place is8-bit clean! -- (else: get itftp://ftp.stat.math.ethz.ch/U/maechler/R/string-test.R )frenchquotes <- "«...»" ## <<...>>frenchquotesUmlaute <- "äöü ÄÖÜ" # = "a "o "u "A "O "UUmlaute #- only the last one is not printed properly...A.accents <- "àáâãäåæ ÀÁÂÃÄÅÆ" # `a 'a ^a "a oa ae `A 'A ^A "A oA AEA.accentsEI.accents <- "ÈÉÊËÌÍÎÏ èéêëìíîï"EI.accentsO.accents <- "ÒÓÔÕÖØòóôõöø"O.accentsU.accents <- "ÙÚÛÜÝùúûüý"U.accentsISO24x <- "¡¢£¤¥¦§ ¨©ª«¬®¯" #octal 241..257ISO26x <- "°±²³´µ¶· ¸¹º»¼½¾¿" #octal 260..277##--- THIS IS a Problem: It gives a SYNTAX error !ISOdiv <- "×÷ Ðð Ññ Þþ ßÿ"##-- One of these characters even was producing the same as 'q()' !!aa_ function(x) {x^2##- frenchquotes <- "«...»" ## <<...>>##- Umlaute <- "äöü ÄÖÜ" # = "a "o "u "A "O "U##- A.accents <- "àáâãäåæ ÀÁÂÃÄÅÆ" # `a 'a ^a "a oa ae `A 'A ^A "A oA AE##- EI.accents <- "ÈÉÊËÌÍÎÏ èéêëìíîï"##- O.accents <- "ÒÓÔÕÖØòóôõöø"##- U.accents <- "ÙÚÛÜÝùúûüý"##-##- ISO24x <- "¡¢£¤¥¦§ ¨©ª«¬®¯" #octal 241..257##- ISO26x <- "°±²³´µ¶· ¸¹º»¼½¾¿" #octal 260..277##- ISOdiv <- "×÷ Ðð" ##-- OMITTED further: SYNTAX error !!}aa----------------------------------------------------------------------TASK: String length problemsSTATUS: Closed ?FROM: <maechler@stat.math.ethz.ch>This is not a cat(.) but a string storing/parsing problem:nchar("\n\n") # gives 2 instead of 3[ Hmmm. Was this typed to readline I wonder? There it ][ seems that ^L must be escaped with ^V. Using the ANSI ][ \f will now produce a literal formfeed. Indeed, using ][ any of the ANSI C escapes will work. ][ However, using the '^L' (emacs C-q C-l) in a string is still dropped:> "\n\n"[1] "\n\n"----------------------------------------------------------------------TASK: FontendSTATUS: OpenFROM:Some time ago there was the suggestion to add a PLATFORMsubdir level for bin (and eventually the library subdirswith `binaries'), and the idea to have the shell wrapperautomagically call the right binary.I mentioned that one might be able to use the shell variablesOSTYPE and HOSTTYPE for that, noticing however that e.g onmy Debian Linux/GNU/ix86bash tcshOSTYPE Linux linuxHOSTTYPE i386 i386-linuxHmm ... It seems (a colleague just checked that) that thesevariables are not POSIX either, and hence I'd say ratheruseless for our purpose.In the absence of a reliable run-time possibility todetermine the current platform, it seems to be natural touse `platform' as obtained at compile-time for possiblydistinguishing the various binaries etc, and leave it atthe discretion of the sysadmin to ensure that the R scriptin the path calls the right binary.If I am missing something obvious, please let me know.----------------------------------------------------------------------TASK: Resetting Graphical ParametersSTATUS: OpenFROM: <maechler@stat.math.ethz.ch>BY THE WAY:It would be nice to be able to saypar(reset = TRUE)(or similar) for resetting all the graphical parameters to their(device-dependent) default values.[ This will require a little work. Perhaps the easiest thing ][ to do is to add a new device driver call "reset". This would ][ be best left to the multiple acyive device driver project. ]----------------------------------------------------------------------TASK: .Options not working in all casesSTATUS: OpenFROM: <maechler@stat.math.ethz.ch>The .Options vector had been introduced a while ago after mysuggestion (see Ross's E-mail below). .Options$digits is usedbe default in several print methods (eg print.lm), however,deparse(.) e.g., uses options()$width, and not .Options$width.Another problem is that .Optionsis still not in the documentation (on-line help).Before one could add it there, we'd need ``the specs''.I think the (at least my) idea was thatoptions(.) queries or sets elements in the .Options listand all functions -- including the internal ones -- use .Options.As far as I know, this is what S does.Currently, this is NOT the case in R.Ross said a while ago:>>> From: Ross Ihaka <ihaka@stat.auckland.ac.nz>>>> Date: Wed, 11 Dec 1996 17:10:59 +1300 (NZDT)>>> To: Martin Maechler <maechler@stat.math.ethz.ch>>>> Cc: R-testers mailing list <R-testers@stat.math.ethz.ch>>>> Subject: R-alpha: options() and .Options -- ?Ross> Martin Maechler writes:>> This is not a bug report, rather than some remarks as a>> "request for comments":>>>> It is clear that options( foo = bar )>> sets the option and also updates the builtin() .Options list :>>>> > options(myopt = pi)>> > .Options$my>> [1] 3.14159265>>>> In S-plus, it was (is) possible to use .Options locally in a function>> frame in order to just affect some options during evaluation of that>> function.Ross> I have made some changes so that such local assignments to .OptionsRoss> will work. The down side is that such assignments will also work atRoss> top level with the changes shadowing the real system options.Ross> This also may be ok. It would have the advantage that options wouldRoss> then be preserved from session to session. Is this a good idea or aRoss> bad idea?----------------------------------------------------------------------TASK:STATUS:FROM:----------------------------------------------------------------------TASK:STATUS:FROM:----------------------------------------------------------------------TASK:STATUS:FROM:----------------------------------------------------------------------TASK:STATUS:FROM:----------------------------------------------------------------------TASK:STATUS:FROM:----------------------------------------------------------------------TASK:STATUS:FROM:----------------------------------------------------------------------