Displaying 20 results from an estimated 8000 matches similar to: "warnings handled oddly in functions with browser calls (PR#13967)"
2011 Dec 06
1
Vignette using parallel's makeCluster function has trouble building on Windows 7
Hi, all--
I've been working on a doParallel package to provide a foreach
parallel backend for the new parallel package, but I am having trouble
building the vignette. On my system, if I use the following minimal
vignette (call it buggyVignette.Rnw):
\documentclass[a4paper]{article}
\title{Sweave Example 1}
\author{Rich Calaway}
\begin{document}
\maketitle
In this example
2009 Oct 21
1
formula and model.frame
Suppose I have the following function
myFun <- function(formula, data){
f <- formula(formula)
dat <- model.frame(f, data)
dat
}
Applying it with this sample data yields a new dataframe:
qqq <- data.frame(grade = c(3, NA, 3,4,5,5,4,3), score = rnorm(8), idVar = c(1:8))
dat <- myFun(score ~ grade, qqq)
However, what I would like is for the resulting dataframe (dat) to include
2009 Sep 23
0
FW: RE: Bug 13937 (setRepositories() doesn't allow graceful cancellation from GUI menu) (PR#13969)
Hi, again-
But I see the behavior has been fixed in the current R-devel build, so sorry
for the noise, and thanks for keeping R such a great package!
--Rich Calaway
_____________________________________________
From: Rich Calaway [mailto:richcalaway at revolution-computing.com]
Sent: Wednesday, September 23, 2009 12:32 PM
To: 'R-bugs at R-project.org'
Subject: RE: Bug 13937
2008 Jan 28
1
package.skeleton from within function: objects not found
Hi all,
I ran into a strange error: I am trying to create a package skeleton for a
new source package from within a function. Objects that are created in this
function are to be included in my package, but for some reason, I get an
error message saying that these objects cannot be found.
Here is the code:
######
myfun <- function(pkgName,x){
myenv <- new.env()
apply(x, 1,
2009 Aug 31
0
setRepositories() doesn't allow graceful cancellation from GUI menu (PR#13937)
Full_Name: Richard Calaway
Version: 2.9.2
OS: Windows Vista
Submission from: (NULL) (65.47.30.18)
If you call setRepositories(graphics=TRUE), or, equivalently, choose "Select
repositories..." from RGui's Packages menu, and then click "Cancel", you are
dropped to the command line menu. Choosing "Cancel" should drop you back to the
top-level prompt. Also, the
2009 Aug 31
0
xy.coords assumes lists will have x and y components, but doesn't check (PR#13936)
Full_Name: Richard Calaway
Version: 2.9.2
OS: Mac OS X 10.5.3
Submission from: (NULL) (65.47.30.18)
Here's my sessionInfo():
> sessionInfo()
R version 2.9.2 (2009-08-24)
i386-apple-darwin8.11.1
locale:
en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
Currently, if you pass a list
2006 Jul 06
1
comment causes browser() to exit (PR#9063)
I'm trying to step through some code using browser(),
executing one line at a time.
Unfortunately, whenever I execute a comment line, the browser exits.
I previously reported a similar problem with blank lines.
These problems are a strong incentive to write poor code
-- uncommented code with no blank lines to improve readability --
so that I can use browser() without it exiting at
2006 Mar 24
0
enhancement request for browser (PR#8706)
I would like a way to modify the behavior of browser(), so that
entering a blank line does nothing rather than being equivalent to "c".
I'm running R using emacs ESS.
I often debug functions by inserting a browser, and stepping through
one line at a time, sending a line at a time from a buffer with
the function to the R buffer.
But every time I send a blank line, the browser
2007 Mar 06
2
bug: sticky symbol refs? (PR#9555)
Hello. What happens in the following is that I create two simple functions, f and g, on the workspace. Then I
replace g. When I then call f, it uses the old version of g. Now clearly, the circumstances for this to happen
must be quite special and rare. But I'd say they're not pathological. It seems to require two things: 1) masked versions
of f and g on a search position lower down the
2001 Oct 02
0
file connection, while, readLines and browser
Dear R-help,
I have one more question about the functions mentioned in the subject.
Again, the system info is:
platform i386-pc-mingw32
arch x86
os Win32 (OK, it's NT4sp6)
system x86, Win32
status
major 1
minor 3.1
year 2001
month 08
day 31
language R
2007 Jan 28
0
"[", .local and S4 methods (was: "[" operator and indexing ambiguity)
Dear Tony,
thanks for the tip with "nargs", when suitably applied, this answers the
problem.
The behaviour of "nargs" in S4 methods has some subtleties compared to
that in normal functions, as shown in the example below. I admit that
this is what had earlier created some confusion about the semantics of
"nargs". From the perspective of "nargs" and its
2009 Jun 12
1
how to trigger variable creation?
Hello R users,
i'm wondering how to trigger variable creation.
Whenever a variable is created i want my own function myFun(...) to be
started.
if (exists("x")) {rm(x)} # after removal of x
# any of these calls
x<-10 # should call myFun
x=10 # should call myFun
assign(x,10) # should call myFun
etc.
2006 Feb 02
2
How to get the namespace of a function?
I declared the environment of the function myfun to be NULL as follows:
environment(myfun) <- NULL
Later on I called that myfun and got an error message because the
function index() in the zoo package was called inside myfun and was
not visible:
Error in myfun(args) : couldn't find function "index"
I tried to use zoo::index() instead of index(), but that did not work.
In fact,
2010 Sep 03
3
S4 Method Signatures
Hello,
If the signature of a method defines which generic it implements then I'm confused about why this minimal example I invented won't work :
setGeneric("myFun", function(rs, ...){standardGeneric("myFun")})
setGeneric("myFun", function(cs, ...){standardGeneric("myFun")})
setMethod("myFun", "numeric", function(rs, colour =
2012 Jul 05
1
Extracting srcref for S4 methods
Hi,
on R version 2.15.1 (2012-06-22) (Platform: i686-pc-linux-gnu (32-bit))
sourced functions have srcref attached as an attribute.
Are such data also available for S4 generics and methods? How? (See
sample code below)
Thank you.
Bests,
Renaud
f <- textConnection(
"
f <- function(){}
setGeneric('myfun', function(x, ...) standardGeneric('myfun'))
2011 Feb 02
1
pass nrow(x) to dots in function(x){plot(x,...)}
Dear Rers,
I have a function to barplot() a matrix, eg
myfun <- function(x, ...) { barplot(x , ... )}
(The real function is more complicated, it does things to the matrix first.)
So I can do:
m1 <- matrix(1:20,4)
myfun(m1)
myfun(m1, main="My title")
I'd like to be able to add the number of rows of the matrix passed to
the function to the "..." argument, eg
2002 Jan 07
1
Mishandling missing "..." (PR#1247)
R> myfun <- function(x, ...) {x[...] <- 0; x}
R> myfun(3)
Error in myfun(3) : SubAssignArgs: invalid number of arguments
It fails because no ... was passed. The workaround (and desired behavior) is:
R> myfun <- function(x, ...) {if (missing(...)) x[] <- 0 else x[...] <- 0; x}
R> myfun(3)
[1] 0
Deja vu? This is the one piece of my PR#1110 (Oct 3, 2001) that I
2015 Oct 22
2
Changed behaviour when passing a function?
Of course (and unsurprisingly) Duncan is correct. I see that behavior in R
3.1.0, as well as the modern ones Duncan mentioned.
What I said is true, as far as it goes, but the symbol being resolved is
FUN, so when looking for a function it doesn't find the function version of
round.
Did you perhaps have a function named FUN in your global environment? If so
you are being bitten by what I
2007 Feb 23
1
how to use apply with two variables
Hi,
this is a made-up example. Function "myfun" returns two arguments. Can
"apply" be used so that "myfun" is called only once?
Thanks
Serguei
mat<-matrix(runif(50),nrow=10,ncol=5)
myfun<-function(x) {
mymean<-mean(x)
mysd<-sd(x)
return(mymean,mysd)
}
out1<-t(apply(mat,1,function(x) myfun(x)$mymean))
out2<-t(apply(mat,1,function(x)
2011 Feb 03
1
mapply question (?)
Hi,
I have a function myFun which I want to call multiple times, using different
argument lists.
myFun("v1", "2009", 1)
myFun("v2", "2008", 1)
myFun("q", "2001")
How can I easily do this in R? Should I use mapply?
I unsuccessfully tried something like:
x <- list(c("v1", "2009", 1), c("v2",