Displaying 7 results from an estimated 7 matches for "lapply2".
Did you mean:
lapply
2008 Jan 31
2
Pb with lapply()
...uot;) : cannot type 'S4' coerce to vector
I still have to do the 'as.list(a)' part myself for things to work:
> lapply(as.list(a), typeof)
[[1]]
[1] "double"
[[2]]
[1] "integer"
Seems like using force() inside lapply() would solve the problem:
lapply2 <- function(X, FUN, ...)
{
FUN <- match.fun(FUN)
if (!is.vector(X) || is.object(X))
X <- force(as.list(X))
.Internal(lapply(X, FUN))
}
It works now:
> lapply2(a, typeof)
[[1]]
[1] "double"
[[2]]
[1] "integer"
Cheers,
H.
1999 Dec 20
1
Manual: writing R Extensions (PR#380)
...nsions" manual
published with RW0.901 and hope this is the right place to report some
possible typos.
page 17, example given in the middle of the page, I think it should read
REAL(version) = 3.0;
^^^^^^^
page 23, second example, I think the parameter definition should read
SEXP lapply2(SEXP list, SEXP fn, SEXP rho)
^^
and the last line of the function I guess should be
VECTOR(ans)[i] = eval(R_fcall, rho);
^^^^^^^^
If my understanding is wrong or you discover another typo in the lapply2
example, ple...
2008 Feb 21
3
applying a function to data frame columns
useR's,
I want to apply this function to the columns of a data frame:
u[u >= range(v)[1] & u <= range(v)[2]]
where u is the n column data frame under consideration and v is a data frame
of values with the same number of columns as u. For example,
v1 <- c(1,2,3)
v2 <- c(3,4,5)
v3 <- c(2,3,4)
v <- as.data.frame(cbind(v1,v2,v3))
uk1 <- seq(min(v1) - .5, max(v1) + .5,
2004 Feb 17
2
interfacing C++ using .Call
...o R using the
.Call interface and am experiencing some problems. I was able to compile
and link the example from Section 4.6 in R-exts.pdf without any
difficulty. But if I take a more complicated example that uses SEXP I'm
able to compile but not link. Here's an example:
Take the "lapply2" code on page 49 of R-exts.pdf and save to "test.c".
Be sure to add
#include <R.h>
#include <Rdefines.h>
to the top of the file.
Now at the command line type:
> Rcmd SHLIB test.c
making test.d from test.c
gcc -Id:/R/rw1081/src/include -Wall -O2 -c test.c -o t...
2005 Jul 21
1
again, a question between R and C++
Dear R Users,
I want to make a call from R into C++. My inputs are List1, List2, List3,
IntegerID. The amount of elements of the lists and their type depend on
IntegerID. Typical elements of a given list can be vectors, doubles, and
even other lists. I want to return also a list (whose nature will depend
also, possibly, on IntegerID).
What I want to do is to call these 4 inputs from C++ and then
2023 Nov 11
1
New syntax for positional-only function parameters?
...lapply(). Somewhere, there's a lot of R code calling lapply(X = X, FUN = FUN, ...), which is currently valid. If positional-only arguments are adopted, lapply() would have to go through a long deprecation cycle before being able to protect its callers from argument name collisions. Still, a new lapply2() would be able to use this immediately.
--
Best regards,
Ivan
2023 Nov 06
2
New syntax for positional-only function parameters?
Dear List,
I'm writing to gauge interest in new syntax for positional-only
function parameters to be added to R.
The pattern of functions accepting other functions as inputs and
passing additional ... arguments to them is prevalent throughout
the R ecosystem. Currently, however, all such functions must one
way or another tackle the problem of inadvertently passing arguments
meant to go to