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
# The packages we'll be using | |
packages <- c("rvest","dplyr","tidyr","pipeR","ggplot2","stringr","data.table") | |
# From those packages, which ones are not yet installed? | |
newPackages <- packages[!(packages %in% as.character(installed.packages()[,"Package"]))] | |
# If any weren't already installed, install them now | |
if(length(newPackages)) install.packages(newPackages) | |
# Now make sure all necessary packages are loaded |
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
## Credit: Taken from: http://stackoverflow.com/questions/1358003/tricks-to-manage-the-available-memory-in-an-r-session | |
# improved list of objects | |
.ls.objects <- function (pos = 1, pattern, order.by, | |
decreasing=FALSE, head=FALSE, n=5) { | |
napply <- function(names, fn) sapply(names, function(x) | |
fn(get(x, pos = pos))) | |
names <- ls(pos = pos, pattern = pattern) | |
obj.class <- napply(names, function(x) as.character(class(x))[1]) | |
obj.mode <- napply(names, mode) | |
obj.type <- ifelse(is.na(obj.class), obj.mode, obj.class) |