been working on the fulltext package lately - and starting thinking
hmmmmmm, it's probably not that easy to extract text from articles for those not familiar with XML, XPATH, etc.
So this happened recently:
| from TwitterSearch import * | |
| import json | |
| try: | |
| tso = TwitterSearchOrder() | |
| tso.set_keywords(['#BOSC2015']) | |
| # Please replace with your credentials | |
| ts = TwitterSearch( | |
| consumer_key='REPLACE_ME', | |
| consumer_secret='REPLACE_ME', |
| git config --global alias.hub '!open $(git config --get remote.origin.url | sed -e "s|git@github\.com:|https://github.com/|" -e "s|git@bitbucket\.org:|https://bitbucket.org/|" -e "s|\.git$||")' |
Notes:
I've tried to break up in to separate pieces, but it's not always possible: e.g. knowledge of data structures and subsetting are tidy intertwined.
Level of Bloom's taxonomy listed in square brackets, e.g. http://bit.ly/15gqPEx. Few categories currently assess components higher in the taxonomy.
| doInstall <- TRUE # Change to FALSE if you don't want packages installed. | |
| toInstall <- c("foreign", "ggplot2", "devtools") | |
| if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")} | |
| lapply(toInstall, library, character.only = TRUE) | |
| source_gist("https://gist.github.com/818983") | |
| source_gist("https://gist.github.com/818986") | |
| source_gist("https://gist.github.com/818998") | |
| # Get NOMINATE data from voteview.org |
| library(memoise) | |
| library(stringr) | |
| git_prompt <- function() { | |
| git <- find_git() | |
| if (is.null(git)) stop("Git not installed", call. = FALSE) | |
| if (!in_git_repo(git)) stop("Not in git repo", call. = FALSE) | |
| update <- function(...) update_prompt(git) |
This code block goes at the top of every Rmd file that I create for eventual conversion by knitr
# sets output for inline results nicely
knit_hooks$set(inline = identity)
# kills knitr if there is an error, therefore we don't waste time generating error messages
knit_hooks$set(error = function(x, options) stop(x))
# these are extremely useful options for working in R| \documentclass{beamer} | |
| \usepackage{url} | |
| \begin{document} | |
| <<setup, include=FALSE, tidy=FALSE, highlight=FALSE>>= | |
| # do not use the highlight package; will do it manually | |
| opts_chunk$set(highlight = FALSE, tidy = FALSE) | |
| tokens = c('dlmMLE', 'dlmModReg') # a list of words to be highlighted by structure{} | |
| knit_hooks$set( | |
| chunk = function(x, options) { |