[Rd] R-ints Argument Evaluation has out of date examples

2016-12-23 Thread Richard Cotton
In R-ints section 1.5 https://cran.r-project.org/doc/manuals/r-devel/R-ints.html#Argument-evaluation it states > Note that being a special/builtin is separate from being primitive > or .Internal: quote is a special primitive, + is a builtin primitive, > cbind is a special .Internal and grep is

[Rd] .S4methods inconsistent behavior with methods, .S3methods

2016-11-03 Thread Richard Cotton
If I call .S4methods(sd) I get the error ## Error in getGeneric(generic.function) : ## argument 'f' must be a string, generic function, or primitive: got an ordinary function By contrast, methods and .S3methods just state that no methods are found. methods(sd) ## no methods found

Re: [Rd] improve 'package not installed' load errors?

2016-10-27 Thread Richard Cotton
> A side question, which I do not know the answer to, is how users get > themselves into this state. I've fallen over this a few times. It happens when you have multiple R sessions running, and R tries to update Rcpp while it is loaded in the other session. For example, I'm working on one

[Rd] using with inside loop breaks next

2016-10-27 Thread Richard Cotton
If I want to use with inside a loop, it seems that next gets confused. To reproduce: for(lst in list(list(a = 1), list(a = 2), list(a = 3))) { with(lst, if(a == 2) next else print(a)) } I expect 1 and 3 to be printed, but I see [1] 1 Error in eval(expr, envir, enclos) : no loop for

Re: [Bioc-devel] \donttest and the "80% of man pages documenting exported objects must have runnable examples" rule

2016-05-17 Thread Richard Cotton
On 17 May 2016 at 13:43, Martin Maechler wrote: > I also wonder *why* you use \donttest{} so extensively. > It's clearly better than \dontrun{} (which really distresses > me, if used more than occasionally). I totally agree with you that \dontrun is overused and

Re: [Bioc-devel] \donttest and the "80% of man pages documenting exported objects must have runnable examples" rule

2016-05-16 Thread Richard Cotton
On 16 May 2016 at 09:26, Hervé Pagès wrote: > I notice that you're using \donttest and not \dontrun though. Are you > saying that the time it would take to run all the examples is < 5 min > but even that is still a burden for you as a developer when you test > your package

[Bioc-devel] \donttest and the "80% of man pages documenting exported objects must have runnable examples" rule

2016-05-15 Thread Richard Cotton
I have a package with a lot of examples in exported functions marked as \donttest. BiocCheck doesn't count these functions towards the target of having 80% of exported objects with runnable examples. I do have more than 80% runnable examples; it's just that BiocCheck can't see them. (For

Re: [R-pkg-devel] What to do when you can't reproduce CRAN R CMD check unit test failures?

2016-05-11 Thread Richard Cotton
than R-devel on > local systems. > > On Wed, May 11, 2016 at 2:40 AM, Richard Cotton <richiero...@gmail.com> wrote: >> Yesterday I uploaded a new version of the pathological package to >> CRAN. It was initially accepted but today I got a message saying that >> some

Re: [Rd] Is it possible to retrieve the last error? (not error *message*)

2016-05-05 Thread Richard Cotton
I wondered the same thing a few days ago. https://stackoverflow.com/questions/36966036/how-to-get-the-last-error The here's the solution from that discussion: get_last_error <- function() { tr <- .traceback() if(length(tr) == 0) { return(NULL) } tryCatch(eval(parse(text =

Re: [Rd] Best way to implement optional functions?

2015-11-23 Thread Richard Cotton
[originating_pkg]{some_function}}. #' @name some_function #' @export NULL I borrowed this idea from dplyr's reexporting of magrittr's pipe. On 17 November 2015 at 00:02, Duncan Murdoch <murdoch.dun...@gmail.com> wrote: > On 16/11/2015 4:00 AM, Richard Cotton wrote: >> >> On 22

[Rd] capturing warnings using capture.output

2015-11-23 Thread Richard Cotton
>From the Details section of ?capture.output: Messages sent to stderr() (including those from message, warning and stop) are captured by type = "message". Note that this can be "unsafe" and should only be used with care. Capturing messages works as expected: capture.output(message("!!!"), type

Re: [Rd] Best way to implement optional functions?

2015-11-16 Thread Richard Cotton
On 22 October 2015 at 22:55, Duncan Murdoch wrote: > I'm planning on adding some new WebGL functionality to the rgl package, but > it will pull in a very large number of dependencies. Since many people won't > need it, I'd like to make the new parts optional. > Can

[Rd] PDFs and SVGs containing rasterGrobs don't display correctly in some other software

2015-11-05 Thread Richard Cotton
I've just been trying to post-process some R-created heatmaps using Inkscape, but I can't get them to display correctly in that software. To reproduce: library(grid) r <- as.raster(matrix(runif(25), 5, 5)) pdf("test.pdf") grid.newpage() grid.raster(r, interpolate = FALSE) dev.off() This figure

[Rd] Differences in printing UTF-8 strings to stdout vs. stderr under Windows

2015-09-22 Thread Richard Cotton
It seems that under Windows, some UTF-8 strings that print OK to stdout do not print correctly to stderr. To reproduce: x <- "\ub124" cat(x, file = stdout()) ## 네 cat(x, file = stderr()) ## Original motivating problem here:

[Rd] Using IDs to suppress specific messages and warnings

2015-09-10 Thread Richard Cotton
The suppressMessages and suppressWarnings functions currently suppress all the message or warnings that are generated by the input expression. The ability to suppress only specific messages or warnings is sometimes useful, particularly for cases like file import where there are lots of things

Re: [Rd] Proposed change in file.exists() to tolerate Windows

2015-09-10 Thread Richard Cotton
Two solutions: 1. Use the wrapper function is_existing_file in assertive. 2. Use standardize_path in pathological before you call file.exists. On 27 August 2015 at 17:02, Paul Johnson wrote: > I'm writing to ask if R Core would make file.exists more Windows > tolerant

Re: [Rd] Using IDs to suppress specific messages and warnings

2015-09-10 Thread Richard Cotton
Thanks Luke, On 10 September 2015 at 14:47, wrote: > Conditions have classes and the condition system is designed around > the idea that classes would be used for this sort of thing. That is > already how tryCatch and withCallingHandlers discriminate the > conditions to

[Rd] Are import-reexport-only packages allowed on CRAN?

2015-07-05 Thread Richard Cotton
One piece of feedback that I received at useR was that the assertive package is getting too big, and should be broken down into smaller pieces. I want to split the functionality into assertive.base, assertive.types, and a few others, then have the assertive package as a virtual package

Re: [Rd] Unicode display problem with data frames under Windows

2015-05-26 Thread Richard Cotton
to deal with it. Since most of the people who tend to do that generally use systems in UTF-8 locales where this isn't a problem, or don't use Windows, it is languishing. Thanks for the link and the explanation of why the bug exists. On May 25, 2015 9:39 AM, Richard Cotton richiero...@gmail.com

[Rd] Unicode display problem with data frames under Windows

2015-05-25 Thread Richard Cotton
Here's a data frame with some Unicode symbols (set intersection and union). d - data.frame(x = A \u222a B \u2229 C) Printing this data frame under R 3.2.0 patched (r68378) and Windows 7, I see d ## x ## 1 A U+222A B n C Printing the column itself works fine. d$x ## [1] A ∪ B

[Rd] Possible values for R version status

2015-03-23 Thread Richard Cotton
Is there a complete list somewhere of the possible values for R's status, as returned by version$status? I know about these values: Stable: Devel: Under development (unstable) Patched: Patched Release candidate: RC Alpha: Alpha Are there any others that I've missed?

Re: [Rd] update.packages with ask = FALSE will sometimes ask about updates

2015-02-13 Thread Richard Cotton
On 13 February 2015 at 10:11, Prof Brian Ripley rip...@stats.ox.ac.uk wrote: On 11/02/2015 10:46, Richard Cotton wrote: The 'at a minimum' information required by the posting guide is conspicuous by its absence. At a guess, this is R-devel and Windows. What I'm running doesn't matter if I'm

[Rd] update.packages with ask = FALSE will sometimes ask about updates

2015-02-11 Thread Richard Cotton
Today while running update.packages(ask = FALSE), R stopped to ask me a question: There are binary versions available but the source versions are later: binary source needs_compilation KernSmooth 2.23-13 2.23-14 TRUE mixture1.2 1.3 TRUE Do you

[Rd] \U with more than 4 digits returns the wrong character

2014-12-04 Thread Richard Cotton
If I type a character using \U syntax that has more than 4 digits, I get the wrong character. For example, \U1d4d0 should print a mathematical bold script capital A. See http://www.fileformat.info/info/unicode/char/1d4d0/index.htm On my machine, it prints the Hangul character corresponding to

Re: [Rd] \U with more than 4 digits returns the wrong character

2014-12-04 Thread Richard Cotton
http://www.markvanderloo.eu --- If you cannot quantify it, you don't know what you're talking about On Thu, Dec 4, 2014 at 8:00 PM, Richard Cotton richiero...@gmail.com wrote: If I type a character using \U syntax that has more than

[Rd] normalizePath is sometimes very slow for nonexistent UNC paths

2014-09-07 Thread Richard Cotton
I'm having an issue with occasionally slow-running calls to normalizePath. If the path is a non-existent UNC path, then normalizePath sometimes takes 6 or 7 seconds to run, rather than its usual few microseconds. My big problem is that I can't reliably reproduce this across machines. The

[Rd] The behaviour of setting names differs between lists and atomic vectors

2014-08-21 Thread Richard Cotton
If you set the names in a list, some cat-style processing seems to happen. For example, backslashes are modified. This behaviour doesn't happen with atomic vectors. Compare, for example: setNames(1, a\\b) ## a\\b ## 1 setNames(list(1), a\\b) ## $`a\b` ## [1] 1 Notice that the name of the

[Rd] --vanilla option for creating cluster nodes

2014-05-13 Thread Richard Cotton
When a PSOCK cluster (maybe other cluster types too) is created by the parallel package, an Rscript process is spawned for each node. At least by default, the Rprofile.site file is read for each node that is created, which can constitute the majority of the time to create a cluster. See:

[Rd] A rep_each function

2014-03-23 Thread Richard Cotton
The rep function is very versatile, but that versatility comes at a cost: it takes a bit of effort to learn (and remember) its syntax. This is a problem, since rep is one of the first functions many beginners will come across. Of the three main uses of rep, two have simpler alternatives. rep(x,

[Rd] How deep can/should lists be nested?

2012-10-14 Thread Richard Cotton
I started idly wondering how deeply lists could be nested, and couldn't find an explicit limit in the documentation. With this simple test a_list - list() count - 0 repeat { a_list[[1]] - a_list count - count + 1 } my (Win7, R-2.16.0 devel) machine threw an error when count got close to

Re: [Rd] Expected behaviour of is.unsorted?

2012-05-23 Thread Richard Cotton
is.unsorted(data.frame(1:2)) [1] FALSE is.unsorted(data.frame(2:1)) [1] FALSE is.unsorted(data.frame(1:2,3:4)) [1] TRUE is.unsorted(data.frame(2:1,4:3)) [1] TRUE IIUC, is.unsorted is intended for atomic vectors only (description of x in ?is.unsorted). Indeed the C source

[Rd] Codoc mismatch for roxygen-documented foo- functions

2012-05-22 Thread Richard Cotton
I have a roxygen2 documented package with functions for getting and setting an attribute. #' Get or set the foo attribute. #' #' Dummy function! #' #' @param x Object to hold the attribute. #' @param value Value to set the attribute to. #' @return The get function returns the foo attribute of

[Rd] Why is there no within.environment function?

2012-03-21 Thread Richard Cotton
If I want to assign some variables into an environment, it seems natural to do something like e - new.env() within(e, { x - 1:5 y - runif(5) } ) This throws an error, since within.environment doesn't exist.  I realise I can work around it using

[Rd] .Internal(inspect(x)) gives overly verbose output for reference classes

2012-03-07 Thread Richard Cotton
Even for an extremely simple instance of a reference class x - setRefClass(x) y - x$new() calling the internal inspect function .Internal(inspect(y)) produces enough output that it takes several minutes to print to the console.  (Actually I gave up and terminated the command after ~10 mins. 

[Rd] Speed issue when writing to RGui console from tcl/tk GUI

2011-12-19 Thread Richard Cotton
It seems that there are speed issues when printing to the R console from a tcl/tk GUI. Here are functions to write a lot of output, and to display how long it takes. printsalot - function(n) { for(i in 1:n) cat(i, fill = TRUE) } timings - function(n = 1e3) {

[Rd] possible bug with log of complex zero

2011-01-10 Thread Richard . Cotton
Notice that log(0i) [1] -Inf+0i but log(0i, ) [1] -Inf+NaNi To me, it seems that these should be the same value. I'll record this on the bug tracker if you agree; otherwise please can someone explain why this is the case. Regards, Richie. Mathematical Sciences Unit HSL 4D Pie Charts

[Rd] n=1 default for random number generators

2009-11-16 Thread Richard Cotton
One tiny thing that would be very nice to have is a default value of n=1 in the random number generator functions, enabling, e.g., runif() instead of runif(1). This won't break anyone's existing code and ought to be relatively straightforward to do. Is there anyone in the core team who would

[Rd] RGui Configuration editor crashes when using an unlisted font (PR#13780)

2009-06-24 Thread richard . cotton
Full_Name: Richard Cotton Version: 2.9.0 OS: Windows XP, SP2, 32 bit Submission from: (NULL) (87.102.99.18) To reproduce the crash: 1. Create an RConsole file for your user account. 2. Close R. 3. Manually edit the font line to include a font that is not on the standard list of available

Re: [Rd] Colour Schemes

2009-05-21 Thread Richard . Cotton
I've been thinking hard about generating colour schemes for data. There's quite a bit of existing code scattered in various packages for playing with colours and colour palettes, but I can't find the sort of thing I'm after for applying colours to data... To my mind a colour scheme is a

Re: [Rd] Colour Schemes

2009-05-21 Thread Richard . Cotton
I'm going to take your second example first. The base graphics image function has zlim arguments which let you do: z=outer(1:10,1:10,*) image(z) image(z/2, zlim=range(z)) but again, not obvious, and complex/impossible when using more sophisticated colour mappings. The way to do

Re: [Rd] A strange behaviour of file.path in Windows? (PR#13119)

2008-10-03 Thread Richard . Cotton
If you send these lines of code: outdir=c:/pippo file.path(outdir,pluto.html) R replies correctly: [1] c:/pippo/pluto.html But if you change the first steps to: outdir= file.path(outdir,pluto.html) R replies (uncorrectly, I think) [1] /c:/pippo/pluto.html I don't get the

[Rd] Filename bug in png

2008-07-03 Thread Richard Cotton
In R2.7.1, the first line of the body of png() reads: checkIntFormat(filename) This should really be: if (!checkIntFormat(file)) stop(invalid 'file') Otherwise a command such as png(foo%s.png) causes R to crash (see bug #10571). - Regards, Richie. Mathematical Sciences Unit HSL

Re: [Rd] Call R from C#

2008-04-08 Thread Richard Cotton
guox wrote: I would like to call functions/objects of R from C#.NET environment. I was wondering whether or not it is possible. If yes, could you please give me some suggestions on how to approach it (any examples/documentation on this)? Thanks! Here are some instructions on calling R

Re: [Rd] %s in filename when opening device causes crash (PR#10571)

2008-01-15 Thread Richard . Cotton
Using %s in a filename when opening a device causes R to crash, e.g., pdf(foo%s.pdf) win.metafile(foo%s.wmf) postscript(foo%s.ps) Do you have a workaround for this? Since that is done at C level, we can't easily trap this (especially on Windows), and the list of possible errors

[Rd] %s in filename when opening device causes crash (PR#10571)

2008-01-14 Thread richard . cotton
Full_Name: Richard Cotton Version: 2.6.1 OS: Windows XP (32bit) Submission from: (NULL) (193.119.236.82) Using %s in a filename when opening a device causes R to crash, e.g., pdf(foo%s.pdf) win.metafile(foo%s.wmf) postscript(foo%s.ps) __ R-devel@r