Difference between revisions of "OpasnetUtils/Tapply"

From Testiwiki
Jump to: navigation, search
m
(code replaced with link to code)
 
(One intermediate revision by one other user not shown)
Line 12: Line 12:
  
 
==Code==
 
==Code==
<rcode
 
name="tapply"
 
label="Initiate functions"
 
graphics="1"
 
>
 
# TAPPLY ########### tapply of ovariables applies a function to each cell of a ragged array, that is to each (non-empty) group of
 
############ values given by a unique combination of the levels of certain factors.
 
### parameters (other parameters are as in generic tapply):
 
### X an ovariable
 
  
temp <- setMethod(f = "tapply",
+
https://www.opasnet.org/svn/opasnet_utils/trunk/R/Tapply.r
signature = signature(X = "ovariable"),
 
definition = function(X, INDEX, FUN = NULL, ..., simplify = TRUE) {
 
out <- as.data.frame(as.table(tapply(X@output$Result, INDEX, FUN, ..., simplify = TRUE)))
 
colnames(out)[colnames(out) == "Freq"] <- "Result"
 
X@output <- out
 
return(X)
 
}
 
)
 
</rcode>
 
  
 
==See also==
 
==See also==

Latest revision as of 14:01, 16 August 2012



Description

tapply of ovariables applies a function to each cell of a ragged array, that is to each (non-empty) group of values given by a unique combination of the levels of certain factors.

Parameters

  • X an ovariable
  • (other parameters are as in generic tapply)

Code

https://www.opasnet.org/svn/opasnet_utils/trunk/R/Tapply.r

See also