Displaying 20 results from an estimated 10000 matches similar to: "using with inside loop breaks next"
2015 Nov 23
1
capturing warnings using capture.output
>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 = "message")
## [1] "!!!"
Capturing warnings
2014 Dec 04
1
\U with more than 4 digits returns the wrong character
Great spot, thanks Mark.
This really ought to appear somewhere in the ?Quotes help page.
Having a warning under Windows might be nicer behaviour than silently
returning the wrong value too.
On 4 December 2014 at 22:24, Mark van der Loo <mark.vanderloo at gmail.com> wrote:
> Richie,
>
> The R language definition [1] says (10.3.1):
>
> \Unnnnnnnn \U{nnnnnnnn}
> (where
2015 May 25
2
Unicode display problem with data frames under Windows
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 ? C
## Levels: A ? B ? C
The encoding is correctly UTF-8.
2015 May 25
5
Unicode display problem with data frames under Windows
On 25/05/2015 11:37 AM, Ista Zahn wrote:
> AFAIK this is the way it works on Windows. It has been discussed in several
> places, e.g.
> http://stackoverflow.com/questions/17715956/why-do-some-unicode-characters-display-in-matrices-but-not-data-frames-in-r
> ,
> http://stackoverflow.com/questions/17715956/why-do-some-unicode-characters-display-in-matrices-but-not-data-frames-in-r
2014 Dec 04
4
\U with more than 4 digits returns the wrong character
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
"\Ud4d0"
http://www.fileformat.info/info/unicode/char/d4d0/index.htm
It seems
2015 Nov 05
2
PDFs and SVGs containing rasterGrobs don't display correctly in some other software
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 should be a five by five block of grey squares. This is
what I see in the R GUI
2016 May 05
1
Too many spaces in deparsed complex numbers with digits17 control option
If you set the "digits17" control option in deparse, you get a lot of
unnecessary space in the representation of complex numbers.
> deparse(0 + 0i)
[1] "0+0i"
> deparse(0 + 0i, control = "digits17")
[1] "0 + 0i"
As far as I can tell, the logic for this comes from this piece of
/src/main/deparse.c:
if (TYPEOF(vector) == CPLXSXP
2015 Jul 15
3
bquote/evalq behavior changed in R-3.2.1
In 3.1.2 eval does not store the result of the bquote-generated call in the
given environment. Interestingly, in 3.2.1 eval does store the result of
the bquote-generated call in the given environment.
In other words if I run the given example with eval rather than evalq, on
3.1.2 "x" is never stored in "fenv," but it is when I run the same code on
3.2.1. However, the given
2015 Jul 15
2
bquote/evalq behavior changed in R-3.2.1
On Jul 15, 2015, at 12:51 PM, William Dunlap wrote:
> I think rapply() was changed to act like lapply() in this respect.
>
When I looked at the source of the difference, it was that typeof() returned 'language' in 3.2.1, while it returned 'list' in the earlier version of R. The first check in rapply's code in both version was:
if (typeof(object) != "list")
2007 May 27
2
Question about "evalq"
The help page of eval says: The 'evalq' form is equivalent to
'eval(quote(expr), ...)'. But the following is not equivalent. Can
anyone give me some explaination? Thanks very much.
> f1 <- function(x,digits=5) lapply(x, f2)
> f2 <- function(x) eval(quote(print(x+1,digits=digits)),list(x=x),parent.frame(2))
> f1(list(x1=1))
[1] 2
$x1
[1] 2
>
> f1 <-
2015 Jul 15
2
bquote/evalq behavior changed in R-3.2.1
David,
If you are referring to the solution that would be:
rapply(list(test), eval, envir = fenv)
I thought I explained in the question that the above code does not work. It
does not throw an error, but the behavior is no different (at least in the
output or result). Using the above code still results in the x object not
being stored in fenv on 3.1.2.
Dayne
On Wed, Jul 15, 2015 at 4:40 PM,
2014 Aug 19
3
Is using devtools::release no longer allowed?
I recently tried to submit a package to CRAN using the release
function in the devtools package and got the response:
> The policies asked you to use the webform: do so in future.
I think that the relevant line in the policies are:
> When submitting a package to CRAN you should use the submission form at
> http://CRAN.R-project.org/submit.html (and not send an email). You will be sent
2015 Jul 15
3
bquote/evalq behavior changed in R-3.2.1
Hello,
I upgraded from 3.1.2 to 3.2.1 and am receiving errors on code that worked
as I intended previously. Briefly, I am using bquote to generate
expressions to modify data.table objects within a function, so I need the
changes to actually be stored in the given environment. Previously, I used
code like the following:
test <- list(bquote(x <- 10))
fenv <- environment()
rapply(test,
2002 Sep 04
3
strange things with eval and parent frames
Dear mailing list,
I have found some strange behaviour which I think relates to parent frames
and eval. Can anyone explain what's going on here?
First example:
> test.parent.funcs_ function() {
outer.var_ 5
subfunc1_ function() substitute( outer.var, envir=parent.frame())
print( subfunc1())
subfunc2b_ function() eval( quote( outer.var), envir=parent.frame())
print(
2014 Sep 07
2
normalizePath is sometimes very slow for nonexistent UNC paths
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 example below generates one or two slow runs out of 10000 on my
Windows machine. I haven't been
2015 Mar 23
4
Possible values for R version status
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?
2015 Jan 14
2
Is the tcltk failure in affylmGUI related to R bug 15957
I maintain the package affylmGUI. It works when installed on many
previous versions of R. I have today tested exactly the same code under
R-2.15.3, R-3.0.2, R-3.1.0, R-3.1.1, R-3.1.2 and R-devel.
I have also tested the versions of affylmGUI downloaded by biocLite for
each version of R and the same result applies.
I have no errors under 2.15.3, 3.0.2, 3.1.0 and 3.1.1. The following
error
2016 May 04
4
Is it possible to retrieve the last error? (not error *message*)
Hi,
at the R prompt, is it possible to retrieve the last error (as in
condition object of class "error")?
I'm not asking for geterrmessage(), which only returns the error
message (as a character string). I'm basically looking for a
.Last.error or .Last.condition, analogously to .Last.value for values,
which can be used when it is "too late" (not possible) to go back
2007 Jun 08
1
evaluating variables in the context of a data frame
Given
> D = data.frame(o=gl(2,1,4))
this works as I expected:
> evalq(o, D)
[1] 1 2 1 2
Levels: 1 2
but neither of these does:
> f <- function(x, dat) evalq(x, dat)
> f(o, D)
Error in eval(expr, envir, enclos) : object "o" not found
> g <- function(x, dat) eval(x, dat)
> g(o, D)
Error in eval(x, dat) : object "o" not found
What am I doing wrong?
2005 Sep 27
3
Dummy quesion about environment
Hi,
I'm trying to understand environment object in R.
I used the example:
f <- function(x) {
y <- 10
g <- function(x) x + y
return(g)
}
h <- f()
h(3)
then i saw that f return an environment
> h
function(x) x + y
<environment: 01B28570>
but I coudn't access to x and y object in that environment:
I tried