inst/doc/tutorial.R

## ---- include = FALSE---------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

load("my_instagramads_data.RData")

## ----setup--------------------------------------------------------------------
library(instagramadsR)

library(dplyr)
library(ggplot2)

## ---- eval = FALSE------------------------------------------------------------
#  
#  my_instagramads_data <-
#    fetch_instagramads(api_key = "your api key",
#             date_from = Sys.Date()-100,
#             date_to = Sys.Date(),
#             fields = c("campaign", "clicks",
#                        "spend", "impressions", "date"))

## -----------------------------------------------------------------------------
str(my_instagramads_data)

## -----------------------------------------------------------------------------
ggplot(my_instagramads_data, aes(y = clicks, fill = campaign)) + geom_boxplot()

## -----------------------------------------------------------------------------
lmod <- glm(clicks ~ campaign, data = my_instagramads_data, family = "poisson")
summary(lmod)

Try the instagramadsR package in your browser

Any scripts or data that you put into this service are public.

instagramadsR documentation built on Oct. 18, 2022, 9:06 a.m.