Talking on Social Media And Social Media Analytics

Over the past seven years, words written by me have hit millions of views. Here is a short talk I gave recently in a workshop at Hauz Khas Village recently

 

Installing Ipython Notebook on Ubuntu 12

I ran into a series of errors and finally managed to make Ipython run on my Ubuntu 12. Notice I am adding some extra stuff in terms of mathjax and pandoc but that is just for a smoother install. Note the trouble point was the package pyzmq but it was troubleshooted by both the –upgrade option as well as the installing of python-dev

sudo apt-get install python-pip
sudo apt-get install python-dev

sudo pip install --upgrade ipython[all]
sudo pip install invoke
sudo pip install jinja2
sudo pip install --upgrade pyzmq

sudo python -m IPython.external.mathjax
sudo apt-get install pandoc
sudo pip install tornado jsonschema

ipython notebook

Screenshot from 2015-04-07 01:03:33

 

Sources-

  1. http://askubuntu.com/questions/390457/how-to-install-the-latest-ipython-notebook-in-ubuntu-12-04
  2. http://askubuntu.com/questions/100529/how-to-install-python-package-pyzmq-properly
  3. http://stackoverflow.com/questions/25318766/gcc-failed-when-pip-upgrading-pyzmq

Teaching Blogging and Social Media Analytics

I am holding a workshop near my residence in Hauz Khas Village, Delhi, India

It is to teach Marketing via Internet, Branding via Blogging and other fun stuff to make money while having fun on the internet.

Here is the event

https://www.facebook.com/events/1399437753708150/

A 2 hour Workshop on Web Analytics and Social Media Analytics
By Ajay Ohri, Founder of DecisionStats and a Technology expert with two published books and blogs with lakhs of views.
10th April 2015, Friday
Venue: Hauz Khas Village

Learn Blogging
Spread your credentials to the entire world by Blogging! It becomes easy for professionals to prove their worth by showing their knowledge through their blog. A good blog earns money too. It definitely acts as your launching pad in the world.

Build Effective Profiles
93% of recruiters review social profiles of candidates while recruiting. Learn how to build awesome profiles on LinkedIn.

Web Analytics (Google Analytics) – Measure your traffic in websites. Improve your web traffic through organic Search Engine Optimization and Search Engine Marketing (Adwords).

What’s More?
Learn how to Run Marketing Campaigns on Twitter & Facebook Pages Facebook can help make and succeed businesses through it’s marketing features.Use Twitter hashtags and campaigns for promoting your product.
Step into a world of unlimited possibilities by a digital analyst training.

Entry fee: Rs 100 per person (Student I card) Rs 200 (normal)

Register :http://bit.ly/decisionstats
Contact: Sonam Tuteja – 9999659616 decisionstats2015@gmail.com

———————————————————————————-

11079581_1582815845321431_8829427897815039618_o

Movie Review Fast and Furious 7 Times Lucky

23#The Seventh Movie in a franchise and yet it scores high in ooh aah moments of car chases, crashes, stunts and surprisingly even the emotional content and appeal. This one is a true send off for the beloved Paul Walker with Vin Diesel, Rocky, Jason Statham, and pals making this the start of a hot hot summer movie season. Oh yeah and watch how they top the MI4/Tom Cruise stunt in Burz Khalifa and how O Conner  gets the best send off in a movie since the Joker ended with an Oscar.

 

 

using R for Cricket Analysis #rstats

New Zealand just made it to their first ever world cup final ( yes it is cricket) and they made it with a thrilling six ( like a home run) for the last ball. Congrats to New Zealand .Of course R was created in New Zealand too and Hadley Wickham is from New Zealand

I recently installed the rvest package from https://github.com/hadley/rvest and its now on CRAN as well

 

rvest helps you scrape information from web pages. It is designed to work with magrittr to make it easy to express common web scraping tasks, inspired by libraries like beautiful soup.

library(rvest)
lego_movie <- html("http://www.imdb.com/title/tt1490017/")

rating <- lego_movie %>% 
  html_nodes("strong span") %>%
  html_text() %>%
  as.numeric()
rating
#> [1] 7.9

cast <- lego_movie %>%
  html_nodes("#titleCast .itemprop span") %>%
  html_text()
cast
#>  [1] "Will Arnett"     "Elizabeth Banks" "Craig Berry"    
#>  [4] "Alison Brie"     "David Burrows"   "Anthony Daniels"
#>  [7] "Charlie Day"     "Amanda Farinos"  "Keith Ferguson" 
#> [10] "Will Ferrell"    "Will Forte"      "Dave Franco"    
#> [13] "Morgan Freeman"  "Todd Hansen"     "Jonah Hill"

poster <- lego_movie %>%
  html_nodes("#img_primary img") %>%
  html_attr("src")
poster
#> [1] "http://ia.media-imdb.com/images/M/MV5BMTg4MDk1ODExN15BMl5BanBnXkFtZTgwNzIyNjg3MDE@._V1_SX214_AL_.jpg"

The most important functions in rvest are:

  • Create an html document from a url, a file on disk or a string containing html with html().
  • Select parts of a document using css selectors: html_nodes(doc, "table td") (or if you’ve a glutton for punishment, use xpath selectors with html_nodes(doc, xpath = "//table//td")). If you haven’t heard of selectorgadget, make sure to read vignette("selectorgadget") to learn about it.
  • Extract components with html_tag() (the name of the tag), html_text() (all text inside the tag), html_attr() (contents of a single attribute) and html_attrs() (all attributes).
  • (You can also use rvest with XML files: parse with xml(), then extract components using xml_node(), xml_attr(), xml_attrs(), xml_text() and xml_tag().)
  • Parse tables into data frames with html_table().
  • Extract, modify and submit forms with html_form(), set_values() and submit_form().
  • Detect and repair encoding problems with guess_encoding() and repair_encoding().
  • Navigate around a website as if you’re in a browser with html_session(), jump_to(), follow_link(), back(), forward(), submit_form() and so on. (This is still a work in progress, so I’d love your feedback.)

 

While Hadley Wickham seems busy with reading excel files ( see https://github.com/hadley/readxl) maybe using rvest can help in more sports analysis now!

https://decisionstats.com/2013/04/25/using-r-for-cricket-analysis-rstats-ipl/

Meanwhile I am searching for equivalent of readHTMLtable

Install R on Ubuntu 12

sudo gedit /etc/apt/sources.list

THEN ADD TO THE NOTEPAD FILE
deb http://cran.rstudio.com/bin/linux/ubuntu precise/

SAVE AND CLOSE

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
sudo apt-get update
sudo apt-get install r-base
sudo apt-get install r-base-dev

RSTUDIO

sudo apt-get install libjpeg62

wget http://download1.rstudio.org/rstudio-0.98.1103-i386.deb

sudo dpkg -i rstudio-0.98.1103-i386.deb