2016-06-15 88 views
1

我試圖用fbRads庫使用R.如何使用fb_insights功能,使用R

https://cran.r-project.org/web/packages/fbRads/fbRads.pdf

我有一個有效的fbaccount對象由fb_init函數返回從Facebook導入數據導入從Facebook的數據和然後我試圖使用完全相同的文檔這裏所說的同一個例子:

l <- fb_insights(fbacc, date_preset = 'today', level = 'ad') 
library(rlist) 
list.stack(list.select(l, date_start, date_stop, ad_id, total_actions, 
total_unique_actions, total_action_value, impressions, unique_impressions, 
social_impressions, unique_social_impressions, clicks, unique_clicks, 
social_clicks, unique_social_clicks, spend, frequency, deeplink_clicks, 
app_store_clicks, website_clicks, reach, social_reach, ctr, unique_ctr, 
cpc, cpm, cpp, cost_per_total_action, cost_per_unique_click, 
relevance_score = relevance_score$score)) 

在可變l,我得到:

>print(l) 
[[1]] 
list() 

然後

>list.stack(list.select(l, date_start, date_stop, ad_id, total_actions, 
+      total_unique_actions, total_action_value, impression .... [TRUNCATED] 
Error in eval(expr, envir, enclos) : object 'date_start' not found 

什麼似乎不是在這裏工作?我該如何解決?

回答

-1

我設法使用以下命令fb_insights(fbacc, level='ad', time_range = '{"since":"2015-08-01","until":"2016-06-31"}')獲得Fb廣告數據,當時間間隔未由time_range定義時,我無法獲取數據。