home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Educational / R-0.49-MI / R-0.49-I / TASKS.OLD < prev    next >
Encoding:
Text File  |  1997-04-21  |  35.1 KB  |  1,012 lines

  1. ----------------------------------------------------------------------
  2. TASK:    No "round" or "signif" for complex arguments.
  3. STATUS:    Closed
  4. FROM:    R@stat.auckland.ac.nz
  5.     [ These are both implemented now ]
  6.  
  7. ----------------------------------------------------------------------
  8. TASK:    "atan" and "atan2" not available for complex arguments.
  9. STATUS:    Closed.
  10. FROM:    Kurt.Hornik@ci.tuwien.ac.at maechler@stat.math.ethz.ch
  11.     [ Implemented (including optional 2nd argument to atan) ]
  12.  
  13. ----------------------------------------------------------------------
  14. TASK:    Check complex "atan" values.
  15. STATUS:    Closed
  16. FROM:    R@stat.auckland.ac.nz
  17.     E.g.  atan(tan(1i)), tan(atan(1i)).
  18.     S-PLUS : Copyright (c) 1988, 1996 MathSoft, Inc.
  19.     S : Copyright AT&T.
  20.     Version 3.4 Release 1 for Sun SPARC, SunOS 4.1.3_U1 : 1996 
  21.     Working data will be in .Data 
  22.     > atan(tan(1i))
  23.     [1] 0-1i
  24.     [ Surely this is an error!!!! ]
  25.  
  26. ----------------------------------------------------------------------
  27. TASK:    Hyperbolic and inverse hyperbolic functions not implemented
  28. STATUS:    Closed
  29. FROM:    R@stat.auckland.ac.nz
  30.     [ We need to check results for complex functions.    ]
  31.     [ We may need to check for hyperbolics in configure. ]
  32.  
  33. ----------------------------------------------------------------------
  34. TASK:    complex "sum" and "mean" not implemented
  35. STATUS:    Closed
  36. FROM:    R@stat.auckland.ac.nz
  37.     [ Implemented these and complex "prod".                ]
  38.     [ Minor bugs in do_summary also fixed.                 ]
  39.     [ Added check in partial sorting for complex argument. ]
  40.  
  41. ----------------------------------------------------------------------
  42. TASK:    logarithm functions
  43. STATUS:    Closed
  44. FROM:    maechler@stat.math.ethz.ch Kurt.Hornik@ci.tuwien.ac.at
  45.     Requests for a version of log which is compatible with the S
  46.     "log(x, base=e)".  It has been noted that "log2" and "log10"
  47.     do not work for complex numbers.
  48.     [ Reimplemented so that everything feeds through "log".       ]
  49.     [ "log10" and "log2" are now interpreted.                     ]
  50.     [ logarithms with a base are currently slower than they       ]
  51.     [ could be because the logarithm of the base is not memoized. ]
  52.  
  53. ----------------------------------------------------------------------
  54. TASK:    "round" results
  55. STATUS:    Closed
  56. FROM:    Kurt.Hornik@ci.tuwien.ac.at maechler@stat.math.ethz.ch
  57.     R> round(.5 + -3:7)
  58.      [1] -3 -2 -1  1  2  3  4  5  6  7  8
  59.     S> round(.5 + -3:7)
  60.      [1] -2 -2  0  0  2  2  4  4  6  6  8
  61.     [ Change round to use rint(3).  This provides the desired ]
  62.     [ behavior.  Is this is feature or bug?                   ]
  63.  
  64. ----------------------------------------------------------------------
  65. TASK:    check availability of rint(3)
  66. STATUS:    Closed
  67. FROM:    R@stat.auckland.ac.nz
  68.     [ Check that rint(3) is available with configure. ]
  69.     [ There should be an #ifdef-ed alternative.       ]
  70.     [ Nah!  Let's just assume its available ...       ]
  71.     [ On second thoughts, it must be conditional for  ]
  72.     [ Windows and the Mac.  There is now a portable   ]
  73.     [ version of this which is #ifdef'd.              ]
  74.  
  75. ----------------------------------------------------------------------
  76. TASK:    assignment of NULL into a list in "lm"
  77. STATUS:    Closed
  78. FROM:    Kurt.Hornik@ci.tuwien.ac.at
  79.     lm(y ~ 1) now works again (was broken in 0.16, thanks!), but:
  80.         R> colnames(y) <- c("V1", "V2")
  81.         R> lm(y ~ 1)
  82.         Error: dimnames: number of dimensions must equal number of names
  83.     The problem is with
  84.         dimnames(z$effects)[[1]] <- NULL
  85.     in lm.fit().
  86.     Replacing it by
  87.         rownames(z$effects) <- NULL
  88.     solves the problem, because "rownames<-" works around the
  89.     problem that l[[i]] <- NULL removes i from the list l.
  90.     [ Note: An (RI) approved idiom for doing this is: ]
  91.     [ dimnames(z)[1] <- list(NULL)                    ]
  92.  
  93. ----------------------------------------------------------------------
  94. TASK:    polyroot/cpoly confusion in CHANGES
  95. STATUS:    Closed
  96. FROM:    Kurt.Hornik@ci.tuwien.ac.at
  97.     The `CHANGES' file mentions the new function `cpoly', which
  98.     is not provided however.  I think it should be `polyroot'.
  99.     [ Updated ]
  100.  
  101. ----------------------------------------------------------------------
  102. TASK:    polyroot problem
  103. STATUS:    Closed
  104. FROM:    Kurt.Hornik@ci.tuwien.ac.at
  105.     "polyroot(1)" currently gives a segfault.
  106.     It should return complex(0).
  107.     [ Arguments of length 0 or one special-cased. ]
  108.  
  109. ----------------------------------------------------------------------
  110. TASK:    formatC configuration
  111. STATUS:    Closed
  112. FROM:    Kurt.Hornik@ci.tuwien.ac.at
  113.      formatC() fails with
  114.         Error in .C("str_signif",  : C/Fortran function not ..."
  115.     And indeed, it is not ...
  116.     As an aside:  strsignif.o is missing from src/applc/Makefile.in
  117.     now (it was the other way round in 0.16.1, I think).
  118.     [ Configuration updated. ]
  119.  
  120. ----------------------------------------------------------------------
  121. TASK:    "read.table" problem with "as.is"
  122. STATUS:    Closed
  123. FROM:    Kurt.Hornik@ci.tuwien.ac.at
  124.     The as.is argument to read.table() does not work as described in the
  125.     help text, values are NOT recycled if necessary.
  126.     A solution is to replace
  127.         if (is.logical(as.is)) {
  128.             if (length(as.is) == 1) 
  129.                 as.is <- rep(as.is, cols)
  130.         }
  131.     in read.table() by
  132.         if (is.logical(as.is)) {
  133.             as.is <- rep(as.is, length = cols)
  134.         }
  135.     [ Change made as suggested. ]
  136.  
  137. ----------------------------------------------------------------------
  138. TASK:    "paste" segfault
  139. STATUS:    Closed
  140. FROM:    Kurt.Hornik@ci.tuwien.ac.at
  141.     paste(list(character(0),""), 1:2) gives a segfault
  142.     [ S turns as.character(list(character(0),"")) into ]
  143.     [ c("character(0)", "\"\"")  i.e. it deparses each ]
  144.     [ element of the list).  We have changed what R so ]
  145.     [ that it does that too.   What has this broken??? ]
  146.  
  147. ----------------------------------------------------------------------
  148. TASK:    binary operations do not handle dimnames correctly
  149. STATUS:    Closed
  150. FROM:    Kurt.Hornik@ci.tuwien.ac.at
  151.     R is not careful enough about dimnames:
  152.         R> x <- structure(1:3, names=LETTERS[1:3])
  153.         R> x
  154.         A B C 
  155.         1 2 3
  156.         R> x + 1
  157.         A B C 
  158.         2 3 4
  159.         R> 1 + x
  160.         [1] 2 3 4
  161.     (and similarly for other ops).
  162.     [ Changes made for arithmetic operators (arithmetic.c) ]
  163.     [ logical operators (logic.c) and relational operators ]
  164.     [ (relop.c).  Also added facilities for arrays and     ]
  165.     [ time series.                                         ]
  166.  
  167. ----------------------------------------------------------------------
  168. TASK:    Errors in "parse" and "source"
  169. STATUS:    Closed
  170. FROM:    plummer@iarc.fr
  171.     #1) The expression in a "for" loop gets turned into a list
  172.     when you read the expression in with source(). eg if the
  173.     file Rexample1 contains the following code
  174.         do <- function()
  175.         {
  176.             n <- 1
  177.             for(i in 1:10) {
  178.                 n <- n*i
  179.             }
  180.         }
  181.     Then this happens when you use source() to read it in
  182.         R> source("Rexample1")
  183.         R> do
  184.         function () 
  185.         {
  186.             n <- 1
  187.             for (i in 1:10) list({
  188.                 n <- n * i
  189.             })
  190.         }
  191.     [ "expression" type is now implemented as a list with ]
  192.     [ "class" equal to expression.                        ]
  193.  
  194. ----------------------------------------------------------------------
  195. TASK:    Errors in "parse" and "source"
  196. STATUS:    Closed
  197. FROM:    plummer@iarc.fr
  198.     Here is a small collection of parse problems which range
  199.     from the slightly irritating to the bizarre. Some of them
  200.     may not be bugs but they're all annoying.  Sorry this is
  201.     so long but I need to illustrate most of them.
  202.     #2) If you forget the closing brackets around an "if"
  203.     statement when editing a function, the editor (vi) returns
  204.     to the R command prompt but any further statements you type
  205.     are added to the function until you supply the closing
  206.     bracket: eg if the function do2 looks like this when you
  207.     edit it
  208.         function (x)
  209.         {
  210.             if(x > 0 ) {
  211.                 foo <- 10/x
  212.         }
  213.     then this is what happens
  214.         R> do2_vi(do2)
  215.         /tmp/00193aaa: 5 lines, 46 characters.
  216.         R> ls()
  217.         + help()
  218.         + }
  219.         R> do2
  220.         function (x) 
  221.         {
  222.             if (x > 0) {
  223.                 foo <- 10/x
  224.             }
  225.             ls()
  226.             help()
  227.         }
  228.     [ EOF was being discarded in the code which deals with ]
  229.     [ context sensitive processing for "if" statements.    ]
  230.  
  231. ----------------------------------------------------------------------
  232. TASK:    Errors in "parse" and "source"
  233. STATUS:    Closed
  234. FROM:    plummer@iarc.fr
  235.     #3) If you put too many closing brackets in a function then
  236.     it is truncated: eg if it looks like this when you edit it
  237.         function (x)
  238.         {
  239.             if (x > 0) {
  240.                 foo <- 10/x
  241.             }}
  242.             bar <- foo
  243.         }
  244.     then you get
  245.     R> do2_vi(do2)
  246.     /tmp/00193aaa: 7 lines, 62 characters.
  247.     R> do2
  248.     function (x) 
  249.     {
  250.         if (x > 0) {
  251.             foo <- 10/x
  252.         }
  253.     }
  254.     [ This was caused by the fact that the "edit" function was ]
  255.     [ only reading a single form from the file created by the  ]
  256.     [ editor.  The fix is to read an arbitrary number of forms ]
  257.     [ and to just evaluate and return the first of these. This ]
  258.     [ forces a syntax check of the entire file.                ]
  259.  
  260. ----------------------------------------------------------------------
  261. TASK:    Errors in "parse" and "source"
  262. STATUS:    Closed
  263. FROM:    plummer@iarc.fr
  264.     #5) When the editor returns the error message "An error
  265.     occured on line ..." then the line number is way out -
  266.     usually by a factor of 10.
  267.     [ Fixed.  Line number was not being initialized. ]
  268.  
  269. ----------------------------------------------------------------------
  270. TASK:    warning messages when doing vector recycling
  271. STATUS:    Closed
  272. FROM:    jlindsey@luc.ac.be (and others)
  273.     When vectors are combined and the length of the longer one
  274.     is not a multiple of the length of the shorter one, a
  275.     warning message should be issued.
  276.     [ Where should this happen in general?  We have added it to  ]
  277.     [ arithmetic and subset assignment.  Is there anywhere else? ]
  278.  
  279. ----------------------------------------------------------------------
  280. TASK:    "any" and "all" problem with numeric data
  281. STATUS:    Closed
  282. FROM:    la-jassine@aix.pacwan.net
  283.     I think the following should return error messages:
  284.     any(0.1)
  285.     [1] TRUE
  286.     all(0.1)
  287.     [1] TRUE
  288.     [ This behavior agrees with S ]
  289.     
  290. ----------------------------------------------------------------------
  291. TASK:    "attach" order is wrong
  292. STATUS:    Closed
  293. FROM:    p.dalgaard@kubism.ku.dk
  294.     R has:
  295.     > attach(data)
  296.     > attach(data[-1])
  297.     > search()
  298.     [1] ".GlobalEnv" "data"       "data[-1]"   ".SystemEnv"
  299.     This is opposite of Splus:
  300.     > attach(data)
  301.     > attach(data[-1])
  302.     > search()
  303.      [1] "/home/sfe/pd/.Data"
  304.      [2] "data[-1]"
  305.      [3] "data"
  306.     [ It was not order, but rather index misinterpretation. ]
  307.  
  308. ----------------------------------------------------------------------
  309. TASK:    is.vector - what about attributes
  310. STATUS:    Closed
  311. FROM:    maechler@stat.math.ethz.ch
  312.     YAI (and a bug: mode='any'  should INCLUDE   mode='language') :
  313.         is.vector(call(ls()))            #[1] FALSE
  314.         is.vector(call(ls()), mode='language')    #[1] TRUE
  315.         is.vector(call(ls()), mode='call')    #[1] FALSE
  316.     And now even more about  S <-> R :
  317.     Looking at  is.vector, I realized that you've duplicated/emulated
  318.     S's bug of
  319.         is.vector( ...named vector... )   #--> FALSE
  320.     This is a bug even mentioned as bug in the ?is.vector
  321.     help page of  S-plus.  ((and I found out:  the bug is
  322.     fixed in S version 4)).
  323.     [ If x has any attribute other than "names" it returns ]
  324.     [ false, otherwise it returns true.                    ]
  325.  
  326. ----------------------------------------------------------------------
  327. TASK:    New "methods" function
  328. STATUS:    Closed
  329. FROM:    maechler@stat.math.ethz.ch
  330.     This is a more useful / extensive 'methods' function,
  331.     modeled after the S one:
  332.     [ Code folded into the base library. ]
  333.  
  334. ----------------------------------------------------------------------
  335. TASK:    "par" values
  336. STATUS:    Closed
  337. FROM:    maechler@stat.math.ethz.ch
  338.     Since I'm wishing already:
  339.     Currently, par() returns a 49-element which is really outdated.
  340.     My current  $RHOME/src/library/funs/par  starts as follows:
  341.     .Pars <- c(
  342.     "1em", "adj", "ask", "bty", "cex", "cin", "col", "cra", "crt", "csi",
  343.     "cxy", "din", "err", "exp", "fig", "fin", "font", "frm", "fty", "lab",
  344.     "las", "lty", "lwd", "mai", "mar", "mex", "mfg", "mgp", "new", "oma",
  345.     "omd", "omi", "pch", "pin", "plt", "pty", "rsz", "smo", "srt", "tck",
  346.     "uin", "usr", "xaxp", "xaxs", "xaxt", "xpd", "yaxp", "yaxs", "yaxt")
  347.     ##>> R-alpha  0.16.1
  348.     ##>>  pp_ par(); names(pp[sapply(pp,is.null)])
  349.     ##>>  [1] "1em" "cxy" "din" "exp" "frm" "fty" "rsz" "uin"
  350.     ##>>       ---   ---   ---   ---   ---   ---   ---   ---  
  351.     ##-- These are the ones used in 0.16.1 -- $RHOME/src/main/par.c  Query(..) :
  352.     .Pars <- c(
  353.     "adj", "ann", "ask", "bg", "bty",
  354.     "cex", "cex.axis", "cex.lab", "cex.main", "cex.sub", "cin",
  355.     "col", "col.axis", "col.lab", "col.main", "col.sub", "cra", "crt", "csi",
  356.     "err", "fg", "fig", "fin",
  357.     "font", "font.axis", "font.lab", "font.main", "font.sub", "lab", "las",
  358.     "lty", "lwd", "mai", "mar", "mex", "mfcol", "mfg", "mfrow", "mgp", "mkh",
  359.     "new", "oma", "omd", "omi", "pch", "pin", "plt", "ps", "pty",
  360.     "smo", "srt", "tck", "tmag", "type", "usr",
  361.     "xaxp", "xaxs", "xaxt", "xlog", "xpd",
  362.     "yaxp", "yaxs", "yaxt", "ylog")
  363.     After starting R (which starts X11),
  364.     this now gives (using my  'str' function):
  365.     > str(par())
  366.     [ pars omitted ]
  367.  
  368. ----------------------------------------------------------------------
  369. TASK:    "is.na" for data frames (generic function needed)
  370. STATUS:    Closed
  371. FROM:    p.dalgaard@kubism.ku.dk plummer@iarc.fr
  372.     > 3) is.na() treats data frames as lists. It always returns
  373.     > a vector of FALSE values with the same length as the
  374.     > names attribute.
  375.     My initial reaction to this was: "but they *are* lists".
  376.     One tends to think of them as "data matrices", but much of
  377.     the useful syntax really is list-like, and in fact
  378.         > is.list(dfr)
  379.         [1] TRUE
  380.     but
  381.         > is.matrix(dfr)
  382.         [1] FALSE
  383.     However, that NA is not an element of the list of vectors
  384.     in a data frame is hardly informative, so it is reasonable
  385.     to expect different behaviour.
  386.     Splus has 
  387.         is.na(dfr)
  388.           x y 
  389.         1 F F
  390.         2 F F
  391.         3 F F
  392.         > class(dfr)<-""
  393.         > is.na(dfr)
  394.         [1] F F
  395.         attr(, "row.names"):
  396.         [1] "1" "2" "3"
  397.         attr(, "class"):
  398.         [1] ""
  399.     So the logic seems to be to special-case data frames by having is.na
  400.     look for the "data.frame" class and if so, recurse into the component
  401.     vectors. 
  402.     [ is.na is now a generic function.  Method dispatch occurs  ]
  403.     [ internally.  There is also a method for class data.frame. ]
  404.  
  405. ----------------------------------------------------------------------
  406. TASK:    "scan" problem
  407. STATUS:    Closed
  408. FROM:    plummer@iarc.fr
  409.     1) Trying to restrict the number of items read by scan()
  410.     using the "nmax" or "nlines" parameters doesn't work when
  411.     "what" is a list.  The problem, which lies in the C function
  412.     scanFrame, can be fixed by this patch to scan.c
  413.     333c333,335
  414.     <                       if(maxlines > 0 && (linesread == maxlines || nc*line
  415.     sread >= maxitems))
  416.     ---
  417.     >                       if(maxitems > 0 && nc*linesread >= maxitems)
  418.     >                               goto done;
  419.     >                       if(maxlines > 0 && linesread == maxlines)
  420.     [ Change made. ]
  421.  
  422. ----------------------------------------------------------------------
  423. TASK:    "apply" problem
  424. STATUS:    Closed
  425. FROM:    plummer@iarc.fr
  426.     2) In the interpreted code for apply(), "dlen" should be
  427.     renamed to "dl".  This bug stops you from using apply on
  428.     a data frame.
  429.     [ This seems to work now. ]
  430.  
  431. ----------------------------------------------------------------------
  432. TASK:    is.numeric incompatibility
  433. STATUS:    Closed
  434. FROM:    thomas@biostat.washington.edu
  435.     is.numeric() returns TRUE for logical variables (in S it
  436.     returns FALSE).  This means that S code which needs to
  437.     distinguish these will work if it uses is.logical() and
  438.     fail if it uses is.numeric().  It also means that for a
  439.     logical vector x the formula y~x is equivalent to y~factor(x)
  440.     in S and y~as.numeric(x) in R. These are different unless
  441.     you use treatment contrasts.
  442.     [ is.numeric changed to refect this.  Again, the ]
  443.     [ question arises.  What has this broken?        ]
  444.  
  445. ----------------------------------------------------------------------
  446. TASK:    PostScript Glitch
  447. STATUS:    Closed
  448. FROM:    p.dalgaard@biostat.ku.dk
  449.     Do a plot in landscape mode, view with ghostscript, select
  450.     "reopen".  Whooplah, plot turns 90 degrees. Only way to
  451.     get it back to horizontal seems to be to modify the Media
  452.     setting or the magnification.
  453.     Someone else mentioned problems with landscape plots
  454.     recently. Could be same thing. I suspect the problem has
  455.     something to do with this:
  456.     %!PS-Adobe-1.0
  457.     [...]
  458.     %%EndComments
  459.     595.28 0 translate 90 rotate
  460.     /Helvetica findfont 10 scalefont setfont
  461.     0.5 setlinewidth
  462.     gsave
  463.     % float float --
  464.     [...]
  465.     Apparently, this stuff executes only once. If you put it
  466.     at the beginning of each page, the problem goes away. (I
  467.     don't quite understand this: At least a complete reopen of
  468.     the file should reexecute the Prologue. shouldn't it? Also
  469.     puzzling me is the fact that there's an unequal supply of
  470.     gsave's (3) and grestore's (2) in the file)
  471.     [ Rewrote the code.  It's much cleaner now. ]
  472.  
  473. ----------------------------------------------------------------------
  474. TASK:    Another PostScript Glitch
  475. STATUS:    Closed
  476. FROM:    p.dalgaard@biostat.ku.dk
  477.     I suspect that there should be a %% comment setting
  478.     the papersize. TeX output from dvips has
  479.     %%DocumentPaperSizes: a4
  480.     but that's with %!PS-Adobe-2.0. Anybody have the relevant
  481.     details on PS structure? (And is there really any reason
  482.     to stick to PS v. 1.0?)
  483.     [ We have switched to Adobe 3.0 structuring. ]
  484.  
  485. ----------------------------------------------------------------------
  486. TASK:    help.start()
  487. STATUS:    Closed
  488. FROM:    Kurt.Hornik@ci.tuwien.ac.at
  489.     I am not sure how useful others find that, but we like the
  490.     idea of using a browser which is already open rather than
  491.     starting a new one.  This can be accomplished by replacing
  492.     help.start() by
  493.         help.start <-
  494.         function(gui = "irrelevant", browser="netscape")
  495.         {
  496.             file <- "$RHOME/html/index.html"
  497.             system(paste(browser, " -remote \"openURL(",
  498.                 file, ")\" 2>/dev/null || ",
  499.                    browser, " ", file, " &", sep = ""))
  500.         }
  501.     Of course, if we decide that the on-line help system will
  502.     eventually be based on HTML, I can extend the above to
  503.     other browsers as well ...
  504.     [ Wow.  This is pretty cool.  We will have to connect this ]
  505.     [ with "help" and "?" to do the searching ...              ]
  506.  
  507. ----------------------------------------------------------------------
  508. TASK:    "axis" limits problem
  509. STATUS:    Closed
  510. FROM:    maechler@stat.math.ethz.ch
  511.     ## R 0.16.1,  Solaris 2.5.x:
  512.         plot(1, 1.79e308)
  513.     gives an infinite loop 
  514.  
  515. ----------------------------------------------------------------------
  516. TASK:    "cbind" segfault
  517. STATUS:    Closed
  518. FROM:    venkat@biosta.mskcc.org
  519.     I am using R 0.16.1
  520.     If I use "cbind(as.vector(1:2),as.array(3:4),as.vector(1:2))"
  521.     I get
  522.           [,1] [,2]
  523.          [1,]    1    3
  524.          [2,]    2    4
  525.     And if I use "cbind(as.array(1:2),as.vector(3:4),as.array(1:2))"
  526.     It crashes the application
  527.  
  528. ----------------------------------------------------------------------
  529. TASK:    array subsetting segfault
  530. STATUS:    Closed
  531. FROM:    ammann@utdallas.edu
  532.     Here's an interesting bug in R.15 and R.16.1:
  533.     x <- array(1:12,c(2,2,3))
  534.     dimnames(x) <- list(c("A","B"),c("C","D"),1:3)
  535.     x
  536.     x[,2,]
  537.     Segmentation fault (core dumped)
  538.  
  539. ----------------------------------------------------------------------
  540. TASK:    argument corruption
  541. STATUS:    Closed
  542. FROM:    schwarte@feat.mathematik.uni-essen.de
  543.     Defining
  544.         qsum<-function(data=data){
  545.           for(i in 2:length(data))
  546.             data[i]<-data[i]+data[i-1]
  547.           data
  548.         }
  549.     And then
  550.         data<-1:10
  551.         tmp<-qsum(data=data)
  552.         print(data)
  553.         print(tmp)
  554.     Demonstrates that data is corrupted.
  555.  
  556. ----------------------------------------------------------------------
  557. TASK:    "sweep" and "crossprod"
  558. STATUS:    Closed
  559. FROM:    jlindsey@luc.ac.be
  560.     Two minor things that it would be useful to have in standard R,
  561.     from S, are sweep and crossprod. Most of the other common
  562.     functions are now in. Jim
  563.  
  564. ----------------------------------------------------------------------
  565. TASK:    "exits" bug
  566. STATUS:    Closed
  567. FROM:    plummer@iarc.fr
  568.     The following program will cause a core dump. It should generate
  569.     an error message.
  570.         do <- function() {
  571.             x <- character(0)
  572.             exists(x)
  573.         }
  574.  
  575. ----------------------------------------------------------------------
  576. TASK:    "nchar" incompatibility
  577. STATUS:    Closed
  578. FROM:    plummer@iarc.fr
  579.     The S-PLUS version of nchar will return a matrix when given a
  580.     matrix, whereas the R version returns a vector.
  581.  
  582. ----------------------------------------------------------------------
  583. TASK:    passing graphical parameters
  584. STATUS:    Closed???
  585. FROM:    plummer@iarc.fr
  586.     It would be nice to be able to pass graphical parameters to
  587.     plotting functions. For example I'm having trouble with calls
  588.     to "legend" in CODA which use the "cex" parameter.
  589.  
  590. ----------------------------------------------------------------------
  591. TASK:    par and hex color specifications
  592. STATUS:    Closed
  593. FROM:    R@stat.auckland.ac.nz
  594.     > par(col=rgb(0,0,0.5020))
  595.     Error: attempt to set invalid value for graphics parameter "col".
  596.     plot(1:10,col=rgb(0,0,0.5))    # ok
  597.     plot(1:10,col=rgb(0,0,0.502))    # not ok
  598.     plot(1:10,col=rgb(0,0,0.506))    # ok
  599.     [ rgb(0,0,0.502) => "#000080".  The bit pattern           ]
  600.     [ corresponding to this was integer NA.                   ]
  601.     [ Fixed by setting the low-order byte of the word to 255. ]
  602.  
  603. ----------------------------------------------------------------------
  604. TASK:    different behavior of Splus and R "factor"
  605. STATUS:    Closed
  606. FROM:    Friedrich.Leisch@ci.tuwien.ac.at
  607.     R> factor(double(0))
  608.     Error in factor(match(x, levels), length(levels), ordered) : invalid number of factor levels
  609.     S> factor(double(0))
  610.     character(0)
  611.     [ Wow.  This is bizzare!  It returns "character" ??? ]
  612.     [ We now do this too, BUT "character" ???!!!          ]
  613.  
  614. ----------------------------------------------------------------------
  615. TASK:    "barplot" problem
  616. STATUS:    Closed
  617. FROM:    Friedrich.Leisch@ci.tuwien.ac.at
  618.     barplot contains several times combinations like
  619.        plot.new(...)
  620.        plot.window(xlim, ylim, log = "", ...)
  621.     which IMHO should be 
  622.        plot.new()
  623.        plot.window(xlim, ylim, log = "", ...)
  624.     [ These changes made and also the window setup has been ]
  625.     [ redone using yaxs="i" and using standard axis.        ]
  626.  
  627. ----------------------------------------------------------------------
  628. TASK:    random number seeds
  629. STATUS:    Closed
  630. FROM:    maechler@stat.math.ethz.ch
  631.     I'am writing a help page about .Random.seed.
  632.     I've been looking a bit at the source,
  633.     i.e,    src/math/sunif.c
  634.         ~~~~~~~~~~~~~~~~~
  635.     and    src/main/random.c
  636.         ~~~~~~~~~~~~~~~~~
  637.     Then I tried
  638.         .Random.seed <- rep(0,3); runif(10)
  639.         ## [1] 0 0 0 0 0 0 0 0 0 0
  640.         rnorm(5)
  641.         ## [1] -2.216036 -2.216036 -2.216036 -2.216036 -2.216036
  642.     and you see that the seed is never changed.
  643.     My proposal (is working, I've tested) :
  644.         Replace lines 51..53 of  main/random.c (in function GetSeeds(..)) with
  645.             ix_seed = INTEGER(seeds)[0]; if(!ix_seed) ix_seed++;
  646.             iy_seed = INTEGER(seeds)[1]; if(!iy_seed) iy_seed++;
  647.             iz_seed = INTEGER(seeds)[2]; if(!iz_seed) iz_seed++;
  648.  
  649.     which also deals with the very rare case
  650.         (not impossible from my documentation of  rand() !!)
  651.     that Randomize(.)  sets one of the i[x|y|z] to 0 accidentally.
  652.     Here is a patch you can apply directly.
  653. --- random.c~    Tue Nov 26 19:13:57 1996
  654. +++ random.c    Wed Mar 19 12:30:44 1997
  655. @@ -48,9 +48,9 @@
  656.          if (!isVector(seeds) || LENGTH(seeds) < 3)
  657.              error("missing or invalid random number seeds\n");
  658.          seeds = coerceVector(seeds, INTSXP);
  659. -        ix_seed = INTEGER(seeds)[0];
  660. -        iy_seed = INTEGER(seeds)[1];
  661. -        iz_seed = INTEGER(seeds)[2];
  662. +        ix_seed = INTEGER(seeds)[0]; if(!ix_seed) ix_seed++;
  663. +        iy_seed = INTEGER(seeds)[1]; if(!iy_seed) iy_seed++;
  664. +        iz_seed = INTEGER(seeds)[2]; if(!iz_seed) iz_seed++;
  665.      }
  666.  }
  667.     [ patch applyied for 0.50 ]
  668.  
  669. ----------------------------------------------------------------------
  670. TASK:    "axis" problem
  671. STATUS:    Closed
  672. FROM:    maechler@stat.math.ethz.ch p.dalgaard@biostat.ku.dk
  673.     [MM] I am still working on the Examples part of the help files,...
  674.     Looking at axis(.),
  675.     I tried
  676.          plot(1:7, rnorm(7), xaxt='n')
  677.          axis(1, 1:7, LETTERS[1:7])
  678.     and was quite disappointed;
  679.     also
  680.         axis(3)
  681.     just does nothing (visible) in the above example;
  682.     whereas
  683.         axis(4)
  684.     does what it should.
  685.     I found out that  axis(..) does NOT seem to work together with
  686.     "[xy]axt = 'n'".
  687.  
  688.     [PD] Yes, plot "forgets to forget" the axis type settings.
  689.     Things work OK if you tack on ,xaxt='l' to the axis calls, but
  690.     surely this can get fixed before the actual release?
  691.  
  692.     I can't spot the bug offhand, but it would seem to be somewhere
  693.     in src/main/plot.c. Everything seems to be surrounded by
  694.     SavePars();/RestorePars(); pairs, but I'm suspecting a
  695.     save-change-save-restore-restore problem: with saves going to
  696.     static data, you could end up 'restoring' a changed parameters
  697.     twice.
  698.     [ Duh! if xaxt="n" then we returned from axis without ]
  699.     [ resetting any of the stored graphics parameters.    ]
  700.     [ This looks like a more general problem.  Shouldn't  ]
  701.     [ we also restore the parameters before error returns ]
  702.     [ too?                                                ]
  703.  
  704.  
  705. ----------------------------------------------------------------------
  706. TASK:    "dotplot"
  707. STATUS:    Closed
  708. FROM:    thomas@biostat.washington.edu
  709.     The labels argument of dotplot() doesn't have any effect when
  710.     the data are in a matrix.
  711.     [ The default of using the row names is now overriden. ]
  712.  
  713. ----------------------------------------------------------------------
  714. TASK:    "dotplot" labels
  715. STATUS:    Closed
  716. FROM:    <hornik@ci.tuwien.ac.at>
  717.     It seems that the current (0.16.1 as well as 0.50 beta 5)
  718.     version of dotplot() ignores the labels and groups arguments in
  719.     the matrix case.  I haven't looked into this very carefully,
  720.     but it seems that one can take care of the `labels' part by
  721.     replacing
  722.         labels <- rownames(x)
  723.     by
  724.         if(is.null(labels))
  725.             labels <- rownames(x)
  726.     and the groups part by e.g. replacing
  727.         groups <- col(x, as.factor=TRUE)
  728.     by
  729.         if(is.null(groups))
  730.             groups <- col(x, as.factor=TRUE)
  731.         else 
  732.             groups <- factor(col(x), labels = groups)
  733.     but the latter is not really fool-proof.
  734.  
  735.     Also, the documentation does not explain the groups argument.
  736.     [ See above. ]
  737.  
  738. ----------------------------------------------------------------------
  739. TASK:    naming in "c", "cbind" and "rbind"
  740. STATUS:    Closed
  741. FROM:    maechler@stat.math.ethz.ch
  742.     This is an old problem / bug which I think  had been solved once
  743.     (partially at least), and still works partially in 0.16.1,
  744.     but it seems it broke (even more) in 0.50-x :
  745.     ##---- 1)  c(..) names  -----
  746.     c(a=pi, b=1)
  747.     # should give        -- and it does give it in 0.16.1 (!)
  748.     #        a        b 
  749.     # 3.141593 1.000000 
  750.     ## but in  0.50-5, the first name is "lost" somewhere
  751.     c(a=pi, b=1)
  752.     #                 b 
  753.     # 3.141593 1.000000 
  754.     #-- the same in this example :
  755.     c(a=1,b=2, d=4:7)
  756.     #     b d1 d2 d3 d4 
  757.     #  1  2  4  5  6  7 
  758.     ##---- 2)  cbind(..) /  rbind(..)   dimnames  -----
  759.     ##-- Here, no  dimnames are produced -- BUT they should! (same for 0.15,0.16):
  760.     cbind(a=1,b=1:3)
  761.     rbind(x=2:4,y=1:3)
  762.     [ We now follow S semantics exactly.                          ]
  763.     [ Well almost.  There appears to be a new arg "deparse.level" ]
  764.     [ to cbind/rbind which provides a different behavior.  It is  ]
  765.     [ really just syntactic sugar though ...                      ]
  766.  
  767. ----------------------------------------------------------------------
  768. TASK:    bug in distance computations
  769. STATUS:    Closed
  770. FROM:    rwehrens@igc.phys.chem.ethz.ch
  771.     In dist.c, function maximum (line 66), the statement      
  772.         if(dist > dev)
  773.     should be replaced by
  774.         if(dev > dist)
  775.     [ MM has also pointed out that there are two distance ]
  776.     [ functions which need to be merged. ]
  777.  
  778. ----------------------------------------------------------------------
  779. TASK:    dotplot
  780. STATUS:    Closed
  781. FROM:    When dotplot is called immediately after device driver startup
  782.     it dies.  It looks like there should be a call to plot.new()
  783.     sooner (as well as where it is a present).
  784.     [ Removed the check at the start of strwidth.            ]
  785.  
  786. ----------------------------------------------------------------------
  787. TASK:    Arguments being mutated
  788. STATUS:    Closed
  789. FROM:    <Andreas.Weingessel@ci.tuwien.ac.at>
  790.     Suppose I have defined the following function
  791.         R> sin.myclass
  792.         function (x) 
  793.         {
  794.             class(x) <- NULL
  795.             plot(sin(x), t = "l")
  796.         }
  797.     If I do
  798.         R> x<-1:10
  799.         R> class(x)<-"myclass"
  800.         R> sin(x)
  801.     I get the expected results (the sinus of x is plotted), but the class
  802.     of x has changed:
  803.     [ The bug from hell bites back. ]
  804.  
  805. ----------------------------------------------------------------------
  806. TASK:    Saving in batch mode
  807. STATUS:    Closed
  808. FROM:    <maechler@stat.math.ethz.ch>
  809.     Go to a directory where you don't have write permission and type
  810.         echo 'x _ 1' | R
  811.     For me (R 0.50-3, but also 0.16.1, on Solaris),
  812.     this gives an infinite loop producing lines of the form
  813.       > 
  814.       Error: can't save data -- unable to open ./.Rdata
  815.       > 
  816.       Error: can't save data -- unable to open ./.Rdata
  817.       > 
  818.       Error: can't save data -- unable to open ./.Rdata
  819.     [ When R is invoked in non-interactive mode, errors are     ]
  820.     [ now considered fatal and no error recovery is attempted.  ]
  821.   
  822. ----------------------------------------------------------------------
  823. TASK:    Segfault in dimnames mutation
  824. STATUS:    Closed
  825. FROM:    <Kurt.Hornik@ci.tuwien.ac.at>
  826.     Btw, here's another way to produce a segfault with admittedly
  827.     nonsense code:
  828.         R> x <- 1:5
  829.         R> dimnames(x)[1,2] <- NULL
  830.         Segmentation fault
  831.     [ Hmmm.  This seems to have gone away.  I get the error     ]
  832.     [ message "Error: incorrect number of subscripts on array". ]
  833.  
  834. ----------------------------------------------------------------------
  835. TASK:    "system" return value
  836. STATUS:    Closed
  837. FROM:    <Kurt.Hornik@ci.tuwien.ac.at>
  838.     If it does not sound too unreasonable, do you think you could
  839.     have system() return the return value of the command if intern
  840.     is FALSE rather than NULL?  (The change shouldn't take more
  841.     than a minute, and would really be helpful ...) Thanks,
  842.     [ Changes made. ]
  843.  
  844. ----------------------------------------------------------------------
  845. TASK:    Postscript (etc fonts)
  846. STATUS:    Closed
  847. FROM:    (venkat@biosta.mskcc.org
  848.     Is there any way of changing fonts (not just the shape which
  849.     font={1,2,3,4} seem to do)?  The PSmetrics seem to be available
  850.     for a lot of fonts but none seem to be accessible except the
  851.     default.
  852.     [ There is a new "family" argument to postscript which     ]
  853.     [ can be any of "AvantGarde", "Bookman", "Courier",        ]
  854.     [ "Helvetica", "Helvetica-Narrow", "NewCenturySchoolbook", ]
  855.     [ "Palatino" or "Times".  In addition, setting font=5 will ]
  856.     [ cause the "Symbol" family to be used.  This is still     ]
  857.     [ experimental and it is hard to see it being used without ]
  858.     [ some sort of math capability.  (That's coming too.)      ]
  859.  
  860.  
  861. ----------------------------------------------------------------------
  862. TASK:    "autoload", "require", "provide"
  863. STATUS:    Closed
  864. FROM:    <Kurt.Hornik@ci.tuwien.ac.at>
  865.     I know it's Easter and not Christmas, but here is something
  866.     that may be nice in future releases of R:
  867.     * A way of autoloading symbols from library packages, similar
  868.     to the way Emacs does this.  E.g., if I think that I need
  869.     Surv() before I can do anything else with the survival library,
  870.     I could put something like
  871.         autoload("Surv", "survival", TRUE)
  872.     in my .Rprofile, and survival would be loaded only after I
  873.     first call Surv().
  874.     * It would also be nice if Thomas' require() and a perhaps something
  875.     like provide() would be available.
  876.     [ Thomas' "require" and "provide" added. "autoload" is on the ]
  877.     [ medium term list.                                           ]
  878.  
  879. ----------------------------------------------------------------------
  880. TASK:    Boxplot fails with NAs
  881. STATUS:    Closed
  882. FROM:    <hornik@ci.tuwien.ac.at>
  883.     Boxplotting objects containing NA's fails with the error message
  884.       Error in plot.window(xlim = c(0.5, n + 0.5), ylim = limits, log = log):
  885.       NAs not allowed in ylim
  886.     The reason seems to be that the extremes of the whiskers computed by
  887.     boxplot.stats(x) are NA if x contains NA's, because
  888.       out <- x < (stats[2] - coef * iqr) | x > (stats[4] + coef * iqr)
  889.     still contains NA's and hence the subsequent
  890.       if (coef > 0) 
  891.         stats[c(1, 5)] <- range(x[!out])
  892.     will set the extremes to NA.
  893.     An obvious idea would be to start by removing NA's in x ... I am not
  894.     sure if this breaks anything.  If this is o.k., the new code for
  895.     boxplot.stats could e.g. be
  896.         boxplot.stats <- function(x, coef)
  897.         {
  898.           x <- x[!is.na(x)]
  899.           n <- length(x)
  900.           stats <- fivenum(x)
  901.           iqr <- diff(stats[c(2, 4)])
  902.           out <- x < (stats[2]-coef*iqr) | x > (stats[4]+coef*iqr)
  903.           if(coef > 0) stats[c(1, 5)] <- range(x[!out])
  904.           conf <- stats[3]+c(-1.58, 1.58)*diff(stats[c(2, 4)])/sqrt(n)
  905.           list(stats=stats, n=n, conf=conf, out=x[out])
  906.         }
  907.     [ Changes similar in  sprirt made. ]
  908.  
  909. ----------------------------------------------------------------------
  910. TASK:    Argument tags botched in c()
  911. STATUS:    Closed
  912. FROM:    <hornik@ci.tuwien.ac.at>
  913.     Please try to get this fixed in the release:
  914.     0.16:
  915.     R> c(a = 1, b = 2)
  916.     a b 
  917.     1 2 
  918.     R> c(a = 1, "b" = 2)
  919.     a b 
  920.     1 2 
  921.     0.50 beta 5:
  922.     R> c(a = 1, b = 2)
  923.       b 
  924.     1 2 
  925.     R> c(a = 1, "b" = 2)
  926.     Segmentation fault
  927.     [ Fixed now ]
  928.  
  929. ----------------------------------------------------------------------
  930. TASK:    rhyper bugs
  931. STATUS:    Closed
  932. FROM:    <VENKAT@biosta.mskcc.org>
  933.     I get strange results when I use rhyper. See below
  934.     > rhyper(1,20,30,10)
  935.     [1] 15
  936.     > rhyper(1,20,30,10)
  937.     [1] 11                      How can you get a value larger than 10
  938.     > rhyper(1,20,30,10)        when you sample only 10
  939.     [1] 9
  940.     > rhyper(2,20,30,10)
  941.     [1] 11 13
  942.     > rhyper(1,50,60,40)
  943.     The final call was running for over 10 minutes when I killed it.
  944.     [ Egads!  Clearly this had never been used before.    ]
  945.     [ There were a series of typos in the interface code. ]
  946.  
  947. ----------------------------------------------------------------------
  948. TASK:    "crossprod" is broken
  949. STATUS:    Closed
  950. FROM:    A.Kovac@Bristol.ac.uk
  951.     > A<-matrix(rep(0, 23*51), ncol=23)
  952.     > B<-matrix(rep(0, 23*51), ncol=23)
  953.     > crossprod(A,B)
  954.     Error in NULL : negative length vectors are not allowed
  955.     The replacement t(A)%*%B works of course. 
  956.     [ The matrix z in the C code was being accessed using the ]
  957.     [ wrong number of rows which was trashing the attributes  ]
  958.     [ (and god knows what else).                              ]
  959.  
  960. ----------------------------------------------------------------------
  961. TASK:    NULL args to "any" and "all" fail.
  962. STATUS:    Closed.
  963. FROM:    Kurt.Hornik@ci.tuwien.ac.at
  964.     We need "all(NULL) -> TRUE" and "any(NULL) -> FALSE".
  965.     [ Oversight. ]
  966.  
  967. ----------------------------------------------------------------------
  968. TASK:    rbind() does something strange to dimnames
  969. STATUS:    Closed.
  970. FROM:    thomas@biostat.washington.edu
  971.     If rbind is used to combine matrices without row names
  972.     there is a seg violation.
  973.     [ Oversight. Aways assumed that row names existed. ]
  974.  
  975. ----------------------------------------------------------------------
  976. TASK:    Some functions not "complex aware"
  977. STATUS:    Closed
  978. FROM:    maechler@stat.math.ethz.ch
  979.     1) Several functions still (0.50 - pre6)
  980.     give seg.faults when called with complex:
  981.         unique( 1i)  --> segfault
  982.     In 'factor', levels are defaulted to  'sort(unique(x))'
  983.     which seg.faults  factor( 1i).
  984.     Because of 'factor', table(..complex..)  seg.faults,.....
  985.     2)  sort ( complex )   [[Of course this is minor ..]]
  986.     You may not believe this can be useful, but...
  987.     I've been digging in old S-code  which makes use of this
  988.     (and also of unique(.))
  989.     Let z = x + 1i*y;  x,y real vectors, then,  
  990.     order(z) : <-->  order(x,y)
  991.     [ Ok, but sorting complex numbers seems like a heresy. ]
  992.  
  993. ----------------------------------------------------------------------
  994. TASK:    "crossprod" problems.
  995. STATUS:    Closed
  996. FROM:    A.Kovac@Bristol.ac.uk
  997.     The function was incorrectly saying "non-conformable args"
  998.     when they were.  Also there was a clear problems with
  999.     dimname attibutes.
  1000.     [ The first of these was a logic problem in the shared code ]
  1001.     [ with matrix products, the second a typo CAR != CADR.      ]
  1002.     [ Threw in complex cross products for good measure.         ]
  1003.  
  1004. ----------------------------------------------------------------------
  1005. TASK:   Differentation broken
  1006. STATUS: Closed
  1007. FROM:   <thomas@biostat.washington.edu>
  1008.         > D(expression(z * (log(z) /z)),"z")
  1009.         Error: invalid form in unary minus check
  1010.  
  1011. ----------------------------------------------------------------------
  1012.