Displaying 1 result from an estimated 1 matches for "meancluster".
Did you mean:
kmeanscluster
2008 Sep 28
2
using tapply on a data frame in a function
...on, but I get the error message from the following code:
"Error in tapply(index, cluster, mean) : arguments must have same length."
Any suggestions? Thanks.
eric
d <- data.frame(cbind(cluster=1:2, value1=1:10, value2=11:20))
d
FindClusterTraits <- function(framename, index){
MeanCluster <- with(framename, tapply(index, cluster, mean))
return(MeanCluster)
}
d2 <- FindClusterTraits(d, 'value1')
[[alternative HTML version deleted]]