Skip to content

Instantly share code, notes, and snippets.

@qoelet
Last active January 3, 2016 06:19
Show Gist options
  • Save qoelet/8421892 to your computer and use it in GitHub Desktop.
Save qoelet/8421892 to your computer and use it in GitHub Desktop.
# load up libraries
library(ggplot2)
library(plyr)
library(XLConnect)
# try and read worksheet directly
original_data <- XLConnect::readWorksheet(loadWorkbook("/home/path/to/given_data.xlsx"), sheet=1)
"
Error: OutOfMemoryError (Java): GC overhead limit exceeded
"
# doesn't work, open in spreadsheet program and export to csv
original_data <- read.csv("/home/path/to/given_data.csv")
# Run View(original_data) in RStudio, all looks on
# Filter out only the columns that I want to look at - inspect via names(original_data)
my_data <- original_data[, c("Date","Channel","Costs", "Orders_XYZ", "User-Type")]
# Rename some of the columns (prefixing library name to show you where they come from)
my_data <- plyr::rename(my_data, c("Orders_XYZ"="Orders", "User-Type"="Grouping"))
# Create vector of filters
my_channel_filter <- c("A", "C", "X")
my_data <- subset(my_data, Channel==my_channel_filter)
# Plot and get a feel of the data
p <- ggplot(my_data, aes(Costs, Channel))
p + geom_dotplot()
# Now I can start working on that data!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment