Displaying 7 results from an estimated 7 matches for "iapply".
Did you mean:
apply
2006 Jun 09
1
Idempotent apply
Dear all,
I have been working on an idempotent version of apply, such that
applying a function f(x) = x (ie. force) returns the same array (or a
permutation of it depending on the order of the margins):
a <- array(1:27, c(2,3,4))
all.equal(a, iapply(a, 1, force))
all.equal(a, iapply(a, 1:2, force))
all.equal(a, iapply(a, 1:3, force))
all.equal(aperm(a, c(2,1,3)), iapply(a, 2, force))
all.equal(aperm(a, c(3,1,2)), iapply(a, 3, force))
I have also generalised apply so that the function can return an array
of any dimension and it will be slotted...
2007 Jan 16
1
curious about dimension of 'apply' output when MARGIN=1
Reading the documentation for 'apply', I understand the following is
working exactly as documented:
> M<-matrix(1:6,ncol=2)
> M
[,1] [,2]
[1,] 1 4
[2,] 2 5
[3,] 3 6
> apply(M,2,function(column) column+c(1,2,3))
[,1] [,2]
[1,] 2 5
[2,] 4 7
[3,] 6 9
> apply(M,1,function(row) row+c(1,2))
[,1] [,2] [,3]
[1,] 2 3 4
2010 Jan 19
4
apply command
Can you please help on the issue?
I using the apply command on a matrix below the example:
Create a vector
x =c(5, 3, 2:4, NA, 7, 3, 9, 2, 1, 5)
create a matrix of 2 rows by 6 columns
b=matrix(x, 2,6)
print(b)
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 5 2 4 7 9 1
[2,] 3 3 NA 3 2 5
using the command apply
print(apply(b, 1, function(y) sort(y, na.last=F)))
the
2006 Aug 06
0
Reshape package: new version 0.7
...This new version of reshape substantially expands the type of output
you can cast into. You can now make nested lists, cast(m, a ~ b | c)
or cast(m, a ~ b | c + d), and multidimensional arrays, cast(m, a ~ b
~ c) (or any combination of the two). See the examples in ?cast.
What else is new?:
* iapply, an idempotent apply function that returns results with the
same dimensionality as the input (very useful in conjunction with
sweep and multidimensional arrays)
* rescaler, a function to rescale data.frames variable by variable
using a range of different scaling methods
* combine_factor and reo...
2006 Aug 06
0
Reshape package: new version 0.7
...This new version of reshape substantially expands the type of output
you can cast into. You can now make nested lists, cast(m, a ~ b | c)
or cast(m, a ~ b | c + d), and multidimensional arrays, cast(m, a ~ b
~ c) (or any combination of the two). See the examples in ?cast.
What else is new?:
* iapply, an idempotent apply function that returns results with the
same dimensionality as the input (very useful in conjunction with
sweep and multidimensional arrays)
* rescaler, a function to rescale data.frames variable by variable
using a range of different scaling methods
* combine_factor and reo...
2010 Jan 20
2
could we use ":" to represent multiple matrice in a list or sequential chracter names
Hi,
I know we can use 1:10 to represent the 1,2,3,...,10 numbers, but the
following conditions are except.
Anybody knows how to represent the following two cases with similar usage
of ":" or others? Usually, i will get several hundred names for them, such
as a1,a2,... or f[[1]],f[[2]],...
#Example data
a1<-array(1:12,c(2,3,2)); a2<-array(2,c(2,3,2)); a3<-array(0,c(2,3,2))
2006 Sep 06
7
Matrix multiplication using apply() or lappy() ?
I am trying to divide the columns of a matrix by the first row in the
matrix.
I have tried to get this using apply and I seem to be missing a concept
regarding the apply w/o calling a function but rather command args %*% /
etc. Would using apply be more efficient than this approach?
I have observed examples in the archives using this type of approach. Does
anybody have a snippet of a call