Displaying 20 results from an estimated 30000 matches similar to: "Getting param names of primitives"
2006 Jul 03
2
Package Unit Testing
Hello,
Do we have like an official unit testing framework for packages? Like
we do R CMD check, and say the scripts in <pkg>/test are executed? Or
do we roll out our own outside the package?
Thanks,
M. Manese
2007 Apr 16
1
args / formals on primitives
On SVN revision 41087:
?args has this example line:
args(c) # -> NULL (c is a 'primitive' function)
The comment seems out of date, as args(c) does in fact have a non-NULL return
value:
args(c)
# function (..., recursive = FALSE)
# NULL
While at it, I was wondering, why
formals(c)
still returns NULL, in contrast.
Regards
Thomas Friedrichsmeier
-------------- next
2018 Oct 07
1
Warning when calling formals() for `[`.
Hello,
This is because args(`[`) returns NULL and class(NULL) is NULL.
So the question would be why is the return value of args(`[`) NULL?
Rui Barradas
?s 15:14 de 07/10/2018, Peter Dalgaard escreveu:
>
>
>> On 7 Oct 2018, at 16:04 , Rui Barradas <ruipbarradas at sapo.pt> wrote:
>>
>> Hello,
>>
>> I don't see why you say that the documentation
2018 Oct 06
1
Warning when calling formals() for `[`.
Hi,
Thanks for the note. How would explain the following snippet taken from
`formals` doc page (the code comment is also from that doc) ?
## formals returns NULL for primitive functions. Use it in combination with
## args for this case.
is.primitive(`+`)
formals(`+`)
formals(args(`+`))
Le sam. 6 oct. 2018 ? 13:42, Rui Barradas <ruipbarradas at sapo.pt> a ?crit :
2018 Oct 07
4
Warning when calling formals() for `[`.
Hello,
I don't see why you say that the documentation seems to be wrong:
class(args(`+`))
#[1] "function"
args() on a primitive does return a closure. At least in this case it does.
Rui Barradas
?s 14:05 de 07/10/2018, Peter Dalgaard escreveu:
> There is more "fun" afoot here, but I don't recall what the point may be:
>
>> args(get("+"))
2018 Oct 06
5
Warning when calling formals() for `[`.
Hi,
A short code example showing the warning might the only thing needed here:
```
> formals(args(`[`))
NULL
*Warning message:In formals(fun) : argument is not a function*
> is.function(`[`)
[1] TRUE
> is.primitive(`[`)
[1] TRUE
```
Now with an other primitive:
```
> formals(args(`sum`))
$...
$na.rm
[1] FALSE
> is.function(`sum`)
[1] TRUE
> is.primitive(`sum`)
[1] TRUE
1999 Jul 15
2
R: UseMethod with primitives?
Hello,
is the following somehow possible with Mod() being a primitive:
"Mod" <- function(x)
UseMethod("Mod")
"Mod.default" <- function(x) {
.Primitive("Mod") ### I know it?s wrong. How can I access the
original Mod ?
}
Thanks for help
M. Eger
--
+-------------------------------------------------------
| Marcus Eger
| Philipps Universitaet
2012 Aug 16
4
Variables and greek letters in a plot title
Hello
This is a problem I encountered repeatedly and I found no answer that made
me really happy. I hope it is not too trivial.
I would like to give the concentration of a substance in a plot title:
5 ug/ml substance
the '5' would be a variable and the ug should be micrograms (with greek
letter mu). It is the mu that causes the problems for me. I failed using
various combinations of
2009 Mar 15
4
primitives again
Dear R Gurus:
How do I find the functions which are primitives, please?
Thanks,
Edna Bell
2020 Aug 19
2
utils::isS3stdGeneric chokes on primitives and identity
Dear R-devel,
utils::isS3stdGeneric tries to subset the body of the function it's fed,
primitives don't like that because they don't have a body, identity doesn't
like it either because it's body is a symbol.
According to the doc, any function is a legal input.
See below:
identity
#> function (x)
#> x
#> <bytecode: 0x0000000013d6da28>
#> <environment:
2012 Mar 19
1
enableJIT(3) with Primitives
I'm not sure if this is a bug or expected behavior, but I don't see
anything in the documentation that explains it, so I thought I'd
mention it:
~ michaelweylandt$ R -q --vanilla
library(compiler)
enableJIT(3)
`+` # Throws an error
`+` # Throws a warning
`+` # Prints the primitive as expected
sessionInfo()
R version 2.14.1 (2011-12-22)
Platform: i386-apple-darwin9.8.0/i386
2020 Aug 20
2
utils::isS3stdGeneric chokes on primitives and identity
>>>>> Gabriel Becker writes:
> I added that so I can look at the proposed fix and put it or something
> similar in bugzilla for review final review.
> Apologies for the oversight.
Fixed now with
- while(as.character(bdexpr[[1L]]) == "{")
+ while(is.call(bdexpr) && (as.character(bdexpr[[1L]]) == "{"))
(the suggested fix does not work on
2020 Jul 10
2
lapply and vapply Primitive Documentation
The documentation of ?lapply includes:
> lapply and vapply are primitive functions.
However, both evaluate to FALSE in `is.primitive()`:
is.primitive(vapply)
#FALSE
is.primitive(lapply)
#FALSE
It appears that they are not primitives and that the documentation
might be outdated. Thank you for your time and work.
Cole Miller
P.S. During research, my favorite `help()` is
2015 Jan 21
2
reducing redundant work in methods package
Doing it like this:
genericForPrimitive <- function(f, where = topenv(parent.frame()), mustFind
= TRUE) {
ans = .BasicFunsList[[f]]
## this element may not exist (yet, during loading), dom't test null
if(mustFind && identical(ans, FALSE))
stop(gettextf("methods may not be defined for primitive function %s
in this version of R",
2018 May 03
1
The stages of standard function evaluation
Dear R Help folks --
I have been trying to put together a list of the steps or stages of R
function evaluation, with particular focus on those that have "standard" or
"nonstandard" forms. This is both for my own edification and also because I
am thinking of joining the world of R bloggers and have been trying to put
together some draft posting that might be useful. I seem to
2009 Oct 01
1
inverse currying
Dear list,
I have the following function,
sugar = function(fun, id = "id"){
ff <- formals(fun)
if( id %in% names(ff))
stop("id is part of args(fun)")
formals(fun) <- c(unlist(ff), alist(id=))
fun
}
which one may use on a function foo,
foo = function(x){
x
}
sugar(foo) # results in the extended closure,
function (x, id)
{
x
}
Its limitation (other
2010 May 05
1
testInstalledBasic question
Hi,
I'm currently in the process of writing an R-installation SOP for my
company. As part of that process I'm using the recommendations from the 'R
Installation and Administration' document, section 3.2, "Testing an
installation". This is done on an XP machine, using the latest binary of
2.11.0.
The binary is downloaded and then installed from the installer. I then
2016 Sep 25
1
Undocumented 'use.names' argument to c()
>From comments in http://stackoverflow.com/questions/24815572/why-does-function-c-accept-an-undocumented-argument/24815653 : The code of c() and unlist() was formerly shared but has been (long time passing) separated. From July 30, 1998, is where do_c got split into do_c and do_unlist.
With the implementation of 'c.Date' in R devel r71350, an argument named 'use.names' is
2020 Aug 28
2
utils::isS3stdGeneric chokes on primitives and identity
Trace adds something to the body of the function, so it does make sense
that it doesn't. Whether traced functions still technically meet the
definition of standard s3 generic or not is, I suppose, up for debate, but
I would say that they should, I think.
As before, if desired I can work on a patch for this if desired, or someone
on R-core can just take care of it if that is easier.
Best,
~G
2004 Jun 17
0
[LLVMdev] Primitive types
On Thu, 17 Jun 2004, Vladimir Prus wrote:
> I'm getting this in debugger, where 't' is 'Type*':
>
> (gdb) p t->isPrimitiveType()
> $15 = false
> (gdb) p t->getPrimitiveID()
> $16 = PointerTyID
> (gdb) p t->getPrimitiveSize()
> $17 = 0
>
> There are a couple of things that I'd like to ask. First, if
>