Skip to content
Prev 17959 / 398503 Next

apply problem

OK.  Efficiency aside,I believe it would still be nice to have this ability 
for compactness.  Here are some ideas:

1. Have an option on t(), the transpose function, that specifies 
that it should return a list of one row data frames.  The above 
becomes:
   sapply( t(iris3,list.out=T), function(x) identical( x, iris3[1,] ) )

2. Allow dist() to have two arguments and a distance function that is 0 
for identical rows and 1 for others (or even allow user specifiable 
distance functions).  The above becomes:
   dist(iris3[1,],iris3,method="identical")
or with user specifiable distance functions:
   dist(iris3[1,],iris3,user.method=identical)

3.  Have a right crossprod such that crossprod(a,b,right=T) is the 
same as a+.*t(b) and also user specifiable inner products:
   crossprod(iris3,iris3[1,],inner.prod=identical)

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._