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
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
> 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
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
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
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
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
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
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 =
[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
>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
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
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
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:
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
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
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
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
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
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
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?
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
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
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
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
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
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
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:
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,
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
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
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
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
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.
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)
{
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
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
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
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
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
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
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
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
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
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
45 matches
Mail list logo