July 2015

Jul 20, 2015

Analyzing Twitter data with R (part 2: Importing Tweets )



Twitter is a magnificent source of very interesting data about the world, trends, products, celebrities, current and past events..etc

This is why I  have been interested in analyzing and working in Twitter data for a long time.




In part one we learned how to set up an application and get some codes and key's to use later one.
In this part of the tutorial, we will look at the ways of searching and importing data from Twitter.

The authentication process is very easy: it has mainly  2 parts:


- Entering the keys and secrets you had from Twitter

- Submitting them for authentication and get access to Twitter's API.


Jul 18, 2015

String manipulation functions in R ( part 1)





I wanted to do this quick tutorial because of an observation I made while working with some New R users who struggle with operations that does not involve numbers, operations and statistical calculations.

Handling text, images, files of all formats, are operations made possible within R via its numerous packages.



This time I started with basic strings, and I will probably add to this series later.

We will learn 4 new functions:

  • grep
  • grepl
These 2 function searches for matches of a given string variable, within each element of a character vector. the only difference between them is the output. The first one gives the position of the string that matches the search, the second one gives a logical result of TRUE or FALSE for all the strings of the vector.
  • gsub
This function performs a substitution of a given string by an other in all the strings given as input for the function.
  • str_replace
This function replaces first occurrence of a matched pattern in a string.



Let's start!
Here we input some text into a vector: