#' Count unique elements in dedundant vector
#' @param inVec A redundant vector of any type
#' @return A data frame where first column contains unique elements while second their respective counts
#' @export
count_of_unique_in_redundant_vector = function(inVec){
o = as.data.frame(matrix(nrow = 1,ncol = 2))
u = unique(inVec)
for(i in 1:length(u)){
c = countOfsomething.2(inVec,u[i])
r = c(u[i],c)
o = rbind(o,r)
}
o = o[-1,]
o = o[order(o[,1]),]
colnames(o) = c("uniqueElement", "count")
row.names(o) = o[,1]
return(o)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.