Displaying 20 results from an estimated 1200 matches similar to: "'deparse(substitute'))' then 'assign' in a S4 methods"
2005 Sep 09
2
A question on R memory management in .Fortran() calls under Windows
Dear R community,
I have a question on how R manages memory allocation in .Fortran()
calls under Windows.
In brief, apparently, it is not possible to allocate large matrices
inside a Fortran subroutine
unless you pass them as arguments. If you do not act in this way
RGUI crashes with a stack overflow error and acting on memory through
vsize nsize ppsize and memory.limit does not help at all.
2009 Sep 09
1
Package that does not work until I re write the exactly the same code
Hi the list,
I am writing a package in S4 and I do not manage to understand a bug.
The "R CMD check" and the "R CMD build" both work. Here is links to the
package (not on CRAN yet for the raison that I explain bellow):
http://christophe.genolini.free.fr/aTelecharger/kml_0.5.zip
http://christophe.genolini.free.fr/aTelecharger/kml_0.5.tar.gz
Then I install the package and I
2006 Jun 20
1
list of interdependent functions
Hello,
I discussed the following problem on the great useR conference with
several people and wonder if someone of you knows a more elegant (or
more common ?) solution than the one below.
The problem:
============
I have several sets of interrelated functions which should be compared.
The functions themselves have different structure, application-specific
names (for readability) and they should
2011 Aug 03
1
NAMESPACE problems
Hi.
I am having difficulty following section 1.6.6 of the R-extensions manual.
I am trying to update the Brobdingnag package to include a NAMESPACE file (the
untb package requires the Brobdingnag package).
Without the NAMESPACE file, the package passes R CMD check cleanly.
However, if I include a NAMESPACE file, even an empty one, R CMD check
gives the following error in 00install.out:
2013 Jan 09
1
deparse substitute
Hi,
I'm writing a function that needs the input names (as characterstrings) as part of the output.
With deparse(substitute( ) ) that works fine, until I replace all zeros with 0.001 (log is calculated at some time):
tf <- function(input) { input[input==0] <- 0.001 ; deparse(substitute(input)) }
myguess <- 42
tf(myguess) # not "myguess", but "42"
Now when
2004 Apr 18
1
deparse(substitute(arg)) in C?
In R code, "deparse(substitute(arg))" is the usual way to construct a
label for an argument. Is there an equivalent to this in C code
working on an SEXP, inside a function called by .Internal()?
Duncan Murdoch
2017 Jan 09
0
problem with print.generic(x)deparse(substitute(x))
On 09 Jan 2017, at 10:53 , Spencer Graves <spencer.graves at prodsyse.com> wrote:
> # Define an object of class 'dum'
> k <- 1
> class(k) <- 'dum'
> str(k) # as expected
>
> # Define print.dum
> print.dum <- function(x, ...)
> deparse(substitute(x))
>
> print(k) # Prints "k" as expected
> #####**** THE FOLLOWING PRINTS
2017 May 07
0
deparse(substitute(x)) fails in implied call to an S3 print method
On 07/05/2017 3:56 PM, Spencer Graves wrote:
> In an implied call to an S3 print method, deparse(substitute(x)) returns
> "x", regardless of the name of object in .GlobalEnv, as indicated in the
> following:
>
>
> > Xnamed <- 1
> > class(Xnamed) <- 'name.x'
> > print.name.x <- function(x, ...){
> + namex <-
2012 May 03
1
deparse(substitute(x)) on an object with S3 class
Dear list,
can someone explain to me why deparse(substitute(x)) does not seem to work
when x is of a user-defined S3 class?
In my actual problem, my print method is part of a package, and the method
is registered in the NAMESPACE, if that should make a difference.
> print.testclass <- function(x,...){
xname <- deparse(substitute(x))
cat("Your object name
2005 Aug 03
1
deparse(substitute(x)) and S3 methods
Dear List,
I have the following function:
coca <- function(x, ...)
{
if(is.null(class(x))) class(x) <- data.class(x)
UseMethod("coca", x)
}
and a default method
coca.default <- function(x, y, method = c("predictive", "symmetric"),
reg.method = c("simpls", "eigen"), weights =
NULL,
2011 Jan 14
2
question about deparse(substitute(...))
Dear R helpers:
I like to apply deparse(substitute()) on multiple arguments to collect the
names of the arguments into a character vector.
I used function test.fun as below. it works when there is only one input
argument. but it does not work for multiple arguements. can someone kindly
help?
test.fun <- function(...){deparse(substitute(...))}
test.fun(x) #this works
test.fun(x,y,z) # I like
2008 Jan 22
1
deparse, substitute and S4 generics
Hello everyone,
I encountered the following confusing behavior of 'deparse' and
'substitute' while programming with S4 classes (see example below). It
seems like the presence of '...' argument in the definition of the
generic generates the problem. I have no clue why, can anyone explain
that to me? Are there any "workarounds"?
Thanks a lot for your time!
2017 Jan 09
1
problem with print.generic(x)deparse(substitute(x))
Hi, Peter et al.:
On 2017-01-09 4:24 AM, peter dalgaard wrote:
> On 09 Jan 2017, at 10:53 , Spencer Graves <spencer.graves at prodsyse.com> wrote:
>
>> # Define an object of class 'dum'
>> k <- 1
>> class(k) <- 'dum'
>> str(k) # as expected
>>
>> # Define print.dum
>> print.dum <- function(x, ...)
>>
2017 Jan 09
2
problem with print.generic(x)deparse(substitute(x))
Hi, All:
I'm having trouble getting deparse(substitute(x)) inside
print.generic to consistently
I'm having trouble getting a print.something to work
consistently. Consider the following toy example:
# Define an object of class 'dum'
k <- 1
class(k) <- 'dum'
str(k) # as expected
# Define print.dum
print.dum <- function(x, ...)
2002 Jan 23
1
Question about substitute (and eval, parse and deparse)
I would like to define a function at run-time, but I just can't make it
work (please don't question why I want to do this, because that would be
too much to explain). For example, I want to define the the following
function
foo <- function(x) {
cat("Function", "foo", "was called with argument", x, ".\n")
}
However, I would like to
2017 May 07
2
deparse(substitute(x)) fails in implied call to an S3 print method
In an implied call to an S3 print method, deparse(substitute(x)) returns
"x", regardless of the name of object in .GlobalEnv, as indicated in the
following:
> Xnamed <- 1
> class(Xnamed) <- 'name.x'
> print.name.x <- function(x, ...){
+ namex <- deparse(substitute(x))
+ cat('How can I get the name of x in .GlobalEnv?\n',
+
2002 Sep 18
3
problem in deparse(substitute())
Hi all,
I am experiencing the following quite strange (at least in my knowledge)
problem in a simple function like the following:
fn<-function(y,v=2){
n<-length(y)
y<-y[(v+1):(n-v)]
plot(y,type="l",lty=3,xlab="Time",ylab=deparse(substitute(y)))
}
fn(rnorm(50)) #look at the plot!!!
The plot appears with numbers on the left side!
If I delete the
2006 Jul 27
3
deparse(substitute(foo))
I see that plot.default uses deparse(substitute(x)) to extract the
character name of an argument and put it on the vertical axis.
Hence:
foo <- 1:10
plot( foo )
will put the label "foo" on the vertical axis.
However, for a function that takes a "..." list as an input, I can only
extract the first argument name:
x <- 1:10
y <- 10:20
foo <- function(...) {
2006 Sep 12
1
package.skeleton() in R-2.4.1
Hi
R version 2.4.0 alpha (2006-09-06 r39158)
MacOSX 10.4.7
There was a thread some time ago as to whether the structure created by
package.skeleton() would pass R CMD check.
I have an example where package.skeleton() gives an R file that gives an
error when sourced.
If I type
setClass("brob",
representation = representation
2009 Nov 19
3
Issue when calling deparse(substitute(x)) from C with "anonymous" R vectors ?
Dear list,
When calling R from C, what appears like a spurious error can be
triggered during the execution of chisq.test(x, y).
This is happening when the following conditions are met:
- x and y are "anonymous" C-level R vectors (they do not have a symbol),
but they are protected from garbage collection
- x and y are "not too small" (it was experienced as soon as they are