Created
November 17, 2014 00:14
-
-
Save vsoch/a68861dfcc1d5f13e1d2 to your computer and use it in GitHub Desktop.
Imaging Scientist Avatar Scoring
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
domain total_points earned_points | |
domain expertise, source 4 2 | |
domain expertise,value 4 2 | |
domain expertise, impact 4 1 | |
programming, breadth 5 4 | |
programming, depth 5 4 | |
programming, software 7 5 | |
methods, implementation 5 3 | |
methods,understanding 7 4 | |
communication, verbal 6 4 | |
communication, written 9 6 | |
communication, visual 8 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Read in data file with domain categories, total points, and earned points | |
data = read.csv("imaging_scientist_scores.txt",sep="\t",head=TRUE) | |
# We want the categories to be the rows | |
rownames(data) = data$domain | |
data = data[,-1] | |
# Now we want to summarize as percents! Let's normalize each to be | |
# a percentage between 0 and 100. For fun, let's write a function that we | |
# can apply to the matrix to return the matrix to plot! | |
unecessary_function_for_score = function(row) { | |
possible = row[1] | |
earned = row[2] | |
total = possible + earned | |
possible_perc = possible / total | |
earned_perc = earned / total | |
return(c(earned_perc,possible_perc)) | |
} | |
# Apply it to our matrix! | |
score = apply(data,1,unecessary_function_for_score) | |
# Oops, let's transpose it so it's more easy to read | |
score = as.data.frame(t(score)) | |
# We want to sort the rows from least to greatest achievment | |
score = score[with(score, order(-earned_points)), ] | |
# We need to make our margins a little bigger for the text | |
par(mar=c(12,4,4,2)) | |
# Get some nice "colours"! | |
colors = sample(colours(),2) | |
# One more flip, and as a matrix for the barplot function... | |
barplot(as.matrix(t(score)), col = colors, main = "Vanessa Graduate Student Avatar Progress!",ylab="progress",xlab="",width=2,las=2) | |
legend(20,.8, inset = c(-0.25, 0), fill = colors, legend = c( "accomplished","to go"),bg="white") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment