Posts

Showing posts from February, 2018

Adventures with R - Facebook Ads (Part 3)

Now that we have set up the required packages and authentications in Facebook, it is time to go to work in R !!

RStudio is the programming interface that I used. For ease of use, I go to Tools --> Global Options --> Appearance. I used Sky as my RStudio theme, Lucida console, font size 11 and Idle Fingers as my Editor theme. It gives a neutral black background and the fonts (comments, code, etc) is much more clearer to see


First part of the code - working directory and packages (All R code is in blue so that it easy to differentiate in the blog)

getwd()

setwd("<Use your own folder directory structure here")

#install.packages("httr")
library(httr)
library(dplyr)

library(devtools)

#devtools::install_github('Rdatatable/data.table')
library(data.table)

#install.packages("cardcorp/fbRads")
library(fbRads)
library(rlist)
library(RODBC)

library(stringr)

The next is a two step process.

Step 1 - One time to get the authentication for the first time
# Getting the aut…