Define and apply custom bins on a dataframe

Another cut answer that takes into account extrema: dat <- read.table(“clipboard”, header=TRUE) cuts <- apply(dat, 2, cut, c(-Inf,seq(0.5, 1, 0.1), Inf), labels=0:6) cuts[cuts==”6″] <- “0” cuts <- as.data.frame(cuts) cosinFcolor cosinEdge cosinTexture histoFcolor histoEdge histoTexture jaccard 1 3 0 0 1 1 0 0 2 0 0 5 0 2 2 0 3 1 0 2 … Read more

How to get summary statistics by group

1. tapply I’ll put in my two cents for tapply(). tapply(df$dt, df$group, summary) You could write a custom function with the specific statistics you want or format the results: tapply(df$dt, df$group, function(x) format(summary(x), scientific = TRUE)) $A Min. 1st Qu. Median Mean 3rd Qu. Max. “5.900e+01” “5.975e+01” “6.100e+01” “6.100e+01” “6.225e+01” “6.300e+01” $B Min. 1st Qu. … Read more