Skip to content

Instantly share code, notes, and snippets.

@rtanglao
Created May 18, 2015 04:32
Show Gist options
  • Save rtanglao/c14f351b3191a7ae58f2 to your computer and use it in GitHub Desktop.
Save rtanglao/c14f351b3191a7ae58f2 to your computer and use it in GitHub Desktop.
test-markdown-in-github

The following (hmmm jekyll won’t render my html tag correctly; until I get it fixed, you can find the proper html rendering of the notebook here) is an Jupiter(fka iPython) notebook showing how to download and install my instagram Vancouver 2014 top colour dataset in R

r = getOption(“repos”) # hard code the UK repo for CRAN
r[“CRAN”] = “http://cran.uk.r-project.org”
options(repos = r)
rm(r)

install.packages(“ig.vancouver.2014.topcolour”)

The downloaded source packages are in
	‘/private/var/folders/v0/4gc0rf6x5t5bsjt77skb0_y00000gn/T/RtmpbTwMy1/downloaded_packages’

library(ig.vancouver.2014.topcolour)

data(“topcolour.ig.vancouver.2014”)

str(topcolour.ig.vancouver.2014)

‘data.frame’:	245736 obs. of  2 variables:
 $ colour: Factor w/ 245736 levels “#000000”,”#000002”,..: 245736 244100 244077 242458 240150 245689 245650 244087 244088 239521 …
 $ count : int  8010 6894 3861 3734 3229 2926 2719 2390 2154 2114 …

head(topcolour.ig.vancouver.2014, 5)
colourcount
1#FFFFFF8010
2#FEFEFE6894
3#FEFCFF3861
4#FBFFFF3734
5#F7FFFF3229
@rtanglao
Copy link
Author

Working R code with labels top 50 (instead of 400) ig van 2014 top colour:

'''r
ggplot(sorted_top_50,aes(x=colorname,y=count))+
geom_bar(colour=head(colour_hex_strings_all,50),
stat=“identity”,fill=head(colour_hex_strings_all,
50),width=1,position = position_dodge(width = 0.005)+
scale_x_discrete(limits = sorted_top_50$colorname)+theme(
axis.text.x = element_text(angle=90, hjust=1,
vjust=0.5,size=10))
'''

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment