files/worker.R

#' @title worker to get number of fans from Facebook API
#' @name worker
#'
#' @description
#' \code{worker} run worker to get number of fans
#'
#' @return saves chart in png and data frame in csv to given directory
#' @export worker
#'
source('~/FanpageData/files/config.R')
library(dplyr)
library(jsonlite)
library(ggplot2)

object = list(id = config$id,
              ad.account = config$ad.account,
              token = config$token,
              date.from = config$date.from,
              date.to = config$date.to,
              directory = config$directory,
              name = config$name)

data = getData(id = object$id, ad.account = object$ad.account, token = object$token,
                      date.from = object$date.from, date.to = object$date.to)
plotGraph(data = data, name = object$name, directory = object$directory,
            date.from = object$date.from, date.to = object$date.to)
saveToCsv(data = data, name = object$name, directory = object$directory)
karolgileta/FanpageData documentation built on June 24, 2017, 8:41 a.m.