Displaying 20 results from an estimated 137 matches for "vappli".
Did you mean:
vapply
2015 Aug 03
2
'vapply' not returning list element names when returned element is a length-1 list
Hi all
Sorry for the confusing title. I noticed the following inconsistency:
If i have a function that returns a named list with 2 (or more) elements,
then using 'vapply' retains the names of the elements:
> vapply(1:3, function(x) list("foo" = "bar", "hello" = "world"),
> vector("list", 2))
[,1] [,2] [,3]
foo
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
2016 Feb 08
2
inconsistency in treatment of USE.NAMES argument
Hi,
Both vapply() and sapply() support the 'USE.NAMES' argument. According
to the man page:
USE.NAMES: logical; if ?TRUE? and if ?X? is character, use ?X? as
?names? for the result unless it had names already.
But if 'X' has names already and 'USE.NAMES' is FALSE, it's not clear
what will happen to the names. Are they going to propagate to the
result
2014 Dec 17
2
vapply definition question
vapply <- function(X, FUN, FUN.VALUE, ..., USE.NAMES = TRUE)
{
FUN <- match.fun(FUN)
if(!is.vector(X) || is.object(X)) X <- as.list(X)
.Internal(vapply(X, FUN, FUN.VALUE, USE.NAMES))
}
This is an implementor question. Basically, what happened to the '...'
args in the call to the .Internal? cf lapply:, where the ... is passed.
lapply <- function (X, FUN, ...)
2014 Apr 12
1
vapply confusion
The following code seems to contain an inconsistency in
the behavior of vapply(). Am I missing something here?
## This function assumes v is a 3d vector, beta a scalar.
f3d <- function(v,beta) { v+beta }
## This expression applies f3d to a vector of scalars, and
## specifies the template 'array(10,3)' for the return value.
dat <- vapply(seq(0,1,length=10), function(beta) {
2016 Feb 11
2
inconsistency in treatment of USE.NAMES argument
Changing the vapply() behavior makes sense in principle. I analyzed
the CRAN code base using the R parser and found 143 instances of
calling vapply with USE.NAMES=FALSE. These would need to be inspected
to understand the consequences of the change.
For reference:
/AzureML/R/datasets.R:226
/BBmisc/R/toRangeStr.R:33
/DBI/R/DBDriver.R:205
/Kmisc/R/str_rev.R:37
/Matrix/R/diagMatrix.R:98
2014 Dec 17
0
vapply definition question
On 12/16/2014 08:20 PM, Mick Jordan wrote:
> vapply <- function(X, FUN, FUN.VALUE, ..., USE.NAMES = TRUE)
> {
> FUN <- match.fun(FUN)
> if(!is.vector(X) || is.object(X)) X <- as.list(X)
> .Internal(vapply(X, FUN, FUN.VALUE, USE.NAMES))
> }
>
> This is an implementor question. Basically, what happened to the '...' args in
> the call to the
2015 Aug 05
0
'vapply' not returning list element names when returned element is a length-1 list
> -----Original Message-----
> From: R-devel [mailto:r-devel-bounces at r-project.org] On Behalf Of Dean Attali
> If i have a function that returns a named list with 2 (or more) elements,
> then using 'vapply' retains the names of the elements:
> ....
> But if the function only returns one element, then the name "foo" is lost
vapply _always simplifies_
2015 Aug 06
0
'vapply' not returning list element names when returned element is a length-1 list
Quote----------------
> If i have a function that returns a named list with 2 (or more) elements,
> then using 'vapply' retains the names of the elements:
> ....
> But if the function only returns one element, then the name "foo" is lost
vapply _always simplifies_ according to the documentation.
In the first case (function return value contains more than one
2016 Feb 09
0
inconsistency in treatment of USE.NAMES argument
>>>>> Herv? Pag?s <hpages at fredhutch.org>
>>>>> on Mon, 8 Feb 2016 10:48:50 -0800 writes:
> Hi,
> Both vapply() and sapply() support the 'USE.NAMES' argument. According
> to the man page:
> USE.NAMES: logical; if ?TRUE? and if ?X? is character, use ?X? as
> ?names? for the result unless it had names already.
2012 Apr 19
2
Trouble with [sv]apply
Friends
I clearly donot understand how sapply and vapply work.
What I have is a function that returns a matrix with an indeterminate
number of rows (some times zero) but a constant number of columns. I
cannot reliably use an apply function to assemble the matrices into a
matrix. I am not sure it is possible.
I can demonstrate the core of my confusion with this simple code.
A.f <-
2020 Jan 23
1
[External] Re: rpois(9, 1e10)
On 1/20/20 12:33 PM, Martin Maechler wrote:
>
> It's really something that should be discussed (possibly not
> here, .. but then I've started it here ...).
>
> The NEWS for R 3.0.0 contain (in NEW FEATURES) :
>
> * Functions rbinom(), rgeom(), rhyper(), rpois(), rnbinom(),
> rsignrank() and rwilcox() now return integer (not double)
> vectors.
2019 Feb 19
4
code for sum function
The algorithm does make a differece. You can use Kahan's summation
algorithm (https://en.wikipedia.org/wiki/Kahan_summation_algorithm) to
reduce the error compared to the naive summation algorithm. E.g., in R
code:
naiveSum <-
function(x) {
s <- 0.0
for(xi in x) s <- s + xi
s
}
kahanSum <- function (x)
{
s <- 0.0
c <- 0.0 # running compensation for lost
2020 Nov 17
3
formatting issue with gcc 9.3.0 on Ubuntu on WSL2
I just got a new Windows laptop (i7, 10th generation CPU), installed
'Windows Subsystem for Linux 2' and then installed Ubuntu 20.04 and
used 'apt-get install' to install packages that the R build seems
to require. In particular, I am using gcc version 9.3.0. The
build went without a hitch but the tests showed that deparse(1e-16)
produced "1.00000000000000e-16" instead
2017 Mar 23
1
A question on stats::as.hclust.dendrogram
Hi all,
This is the first time I'm writing to R-devel, and this time I'm just asking for the purpose for a certain line of code in stats::as.hclust.dendrogram, which comes up as I'm trying to fix dendextend.
The line in question is at line 128 of dendrogram.R in R-3.3.3, at stats::as.hclust.dendrogram:
stopifnot(length(s) == 2L, all( vapply(s, is.integer, NA) ))
Is there any
2024 Jun 13
1
Integration of functions with a vector argument
? Wed, 12 Jun 2024 23:42:18 +0000
"Levine, Michael" <mlevins at purdue.edu> ?????:
> f.int1 <- function(x,y) {Vectorize (function(y) f(c(x,y),H=H,j=j))}
Vectorize returns a callable function(y), so wrapping it in a
function(x,y) will not work. Since you'd like to integrate over y, we
can perform the same transformation manually using vapply:
# A version of f(...) that
2011 Aug 22
1
Data Frame Indexing
Hello,
I've been dealing with a set of values that contain time stamps and part
of my summary needs to look at just weekend data. In trying to limit the
data I've found a large difference in performance in the way I index a
data frame. I've constructed a minimal example here to try to explain my
observation.
is.weekend <- function(x) {
tm <-
2011 Oct 05
1
Vector-subsetting with ZERO - Is behavior changeable?
Dear All,
I have trouble generizising some code.
> index <- 0
> sapply(list(c(1,2,3),c(1,2),c(1)),function(x){x[max(length(x)-index,0)]})
Will yield a wished for vector like so:
[1] 3 2 1
But in this case (trying to select te second to last element in each vector
of the list)
> index <- 1
> sapply(list(c(1,2,3),c(1,2),c(1)),function(x){x[max(length(x)-index,0)]})
I end up
2023 Mar 02
3
tab-complete for non-syntactic names could attempt backtick-wrapping
There turn out to be a few more things to fix.
One problem is easy to solve: vapply() needs a third argument
specifying the type of the return value. (Can we have unit tests for
tab completion?)
The other problem is harder: `comps` defaults to an empty string, and
you can't have a symbol consisting of an empty string, because this
value is internally reserved for missing function arguments.
2020 Nov 18
2
formatting issue with gcc 9.3.0 on Ubuntu on WSL2
On Wed, 18 Nov 2020 at 10:26, Tomas Kalibera <tomas.kalibera at gmail.com> wrote:
>
> On 11/17/20 9:34 PM, Bill Dunlap wrote:
> > I just got a new Windows laptop (i7, 10th generation CPU), installed
> > 'Windows Subsystem for Linux 2' and then installed Ubuntu 20.04 and
> > used 'apt-get install' to install packages that the R build seems
> > to