Created
January 2, 2014 20:35
-
-
Save geoffjentry/8226310 to your computer and use it in GitHub Desktop.
massage data
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 the TIOBE data | |
tiobe = read.csv("tiobe.csv", stringsAsFactors=FALSE) | |
tiobe_langs = tolower(tiobe[, "lang"]) | |
# Looking at the TIOBE listings and some of the tweet data, massage some of the entries | |
# here. This won't be perfect but will help a little bit | |
replace_statuses = function(statuses, was, is) { | |
gsub(was, is, statuses, ignore.case=TRUE) | |
} | |
replacements = list(c("objective c", "objective-c"), c("visual basic", "visual-basic"), | |
c("emacs lisp", "emacs-lisp"), c("object pascal", "delphi/object-pascal"), | |
c("delphi", "delphi/object-pascal"), c("common lisp", "common-lisp"), | |
c("elisp", "emacs-lisp")) | |
for (pair in replacements) { | |
statuses = replace_statuses(statuses, pair[1], pair[2]) | |
} | |
tiobe_langs[7] = "visual-basic" | |
tiobe_langs[11] = "visual-basic" | |
tiobe_langs[20] = "delphi/object-pascal" | |
tiobe_langs[46] = "emacs-lisp" | |
tiobe_langs[41] = "common-lisp" | |
tiobe$lang = tiobe_langs | |
# we've got two visual-basic entries | |
tiobe[7, "rating"] = tiobe[7, "rating"] + tiobe[11, "rating"] | |
tiobe = tiobe[-11, ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment