Skip to content

Instantly share code, notes, and snippets.

@jimlindstrom
jimlindstrom / plot-likert.r
Created November 30, 2011 03:36
Plotting Likert-scale data with R
# Inputs
feature_names <- c("Feature 5", "Feature 4", "Feature 3", "Feature 2", "Feature 1")
num_features <- length(feature_names)
y <- array(c(10,4,1,0, 3,4,2,0, 1,2,8,1, 0,0,5,1, 1,2,5,3), dim=c(4,num_features))
# Calculate plot
num_neg_ratings <- 0
num_pos_ratings <- 0
for(i in 1:num_features) {
num_neg_ratings = max(num_neg_ratings, sum(y[1:2,i]), sum(y[3:4,i]))
@jimlindstrom
jimlindstrom / css-based-icons.sass
Created October 24, 2011 01:59
CSS3-based Checkbox and Exclamation Icons without using images
@mixin span-icon
float: left
height: 9px
line-height: 11px
font-size: 13px
font-weight: 800
margin-top: 2px
margin-bottom: 1px
margin-right: 4px
padding-bottom: 4px