Skip to content

Instantly share code, notes, and snippets.

@jlehtoma
Created April 28, 2012 17:22
Show Gist options
  • Save jlehtoma/2520585 to your computer and use it in GitHub Desktop.
Save jlehtoma/2520585 to your computer and use it in GitHub Desktop.
R's market share
library(ggplot2)
library(reshape2)
library(scales)
Scholar <- read.csv("scholarly_impact_2012.4.9.csv")
Little6 <- c("JMP","Minitab","Stata","Statistica","Systat","R")
Subset <- Scholar[ , Little6]
Year <- rep(Scholar$Year, length(Subset))
ScholarLong <- melt(Subset)
names(ScholarLong) <- c("Software", "Hits")
ScholarLong <- data.frame(Year, ScholarLong)
#png("marketshare.png")
ggplot(ScholarLong, aes(Year, Hits, group=Software)) +
geom_smooth(aes(fill=Software), position="fill") +
coord_flip()+
scale_x_continuous("Year", trans="reverse") +
scale_y_continuous("Proportion of Google Scholar Hits For Each Software", labels = NULL)+
opts(title = expression("Market Share"), axis.ticks = theme_blank())
#dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment