applyXPtr: Apply facility for objects of class XPtr

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

This tool function allow to apply a function along some index and on a subset of elements of the XPtr object. Is the counterpart of apply for objects fo class matrix.

Usage

1
applyXPtr(d, idx, sub, f)

Arguments

d

an object of class XPtr

idx

a vector of integers, the indexes of the apply

sub

a vector of integers, the indexes of the subest

f

a function to be evaluated in the .GlobalEnv

Details

The object d is like a dist object, which is one-dimensional but usually associated to a symmetrix matrix M with 0's on the diagonal. This function allows to apply a function f on d as if it was applied this way on the matrix M: apply(M[idx,sub],1,f).

Value

val

an invisible object of type list

Author(s)

S.M. Iacus

References

Iacus, S.M., Porro, G. (2009) Random Recursive Partitioning: a matching method for the estimation of the average treatment effect, Journal of Applied Econometrics, 24, 163-185.

Iacus, S.M., Porro, G. (2007) Missing data imputation, matching and other applications of random recursive partitioning, Computational Statistics and Data Analysis, 52, 2, 773-789.

See Also

newXPtr

Examples

1
2
3
4
5
6
7
8
a <- newXPtr(10,1)
addXPtr(a, list(c(1,3,4,9), c(2,5), c(1,7,9)), c(-1, 5, 10))
f <- function(x) sum(x)
idx <- 1:5
sub <- 7:10
applyXPtr(a, idx, sub, f) -> l
(XPtrToDist(a))
l

rrp documentation built on May 2, 2019, 5:25 p.m.

Related to applyXPtr in rrp...