【发布时间】:2018-10-12 06:42:49
【问题描述】:
Error in data.table::rbindlist(.data, ...) :
attempt to set an attribute on NULL
我在以下位置收到此错误:
FBInsightsExpanded <- list.stack(list.select(FBInsightsExpanded, website_purchase_roas = website_purchase_roas$action_link_click_destination));
print(FBInsightsExpanded)
这就是 DF 的样子。我猜我需要用 NA 替换 NULL。但目前无法修复它
website_purchase_roas date_stop
1 0.673001 offsite_conversion.fb_pixel_purchase, 6.506892 2018-10-11
2 1.369035 offsite_conversion.fb_pixel_purchase, 0.594109 2018-10-11
3 2.084238 NULL 2018-10-11
4 1.31209 NULL 2018-10-11
5 2.337662 NULL 2018-10-11
6 0.996678 NULL 2018-10-11
7 1.936385 offsite_conversion.fb_pixel_purchase, 1.482508 2018-10-11
8 2.777778 NULL 2018-10-11
9 0 NULL 2018-10-11
10 1.994885 NULL 2018-10-11
11 2.402023 NULL 2018-10-11
12 4.635056 offsite_conversion.fb_pixel_purchase, 5.222421 2018-10-11
13 0 NULL 2018-10-11
14 1.990291 NULL 2018-10-11
15 6.557377 NULL 2018-10-11
16 3.703704 NULL 2018-10-11
17 3.038936 NULL 2018-10-11
代码如下:
library(httr)
library(fbRads)
library(rlist)
library(rhdfs)
library(Rfacebook)
library(SocialMediaLab)
library(dplyr)
app <- oauth_app('facebook', 'xxxxxxxxxx', 'xxxxxxxxxxxxxxxxxxxxxx')
fbacc <- fbad_init(accountid = id, token = "token", version = '3.0')
FBInsightsExpanded <- fb_insights(level = 'ad',
time_range=sprintf("{'since':%s,'until':%s}", paste('"', maxDate, '"', sep=''), paste('"', yesterdayDate, '"', sep='')), time_increment= 1 ,
fields = toJSON(c("impressions",
"date_start",
"reach",
"frequency",
"ad_name",
"adset_name",
"campaign_name",
"clicks",
"cpc",
"cpm",
"cpp",
"ctr",
"objective",
"spend",
"account_name",
"ad_id",
"adset_id",
"buying_type",
"campaign_id",
"canvas_avg_view_time",
"cost_per_unique_click",
"inline_link_click_ctr",
"social_spend",
"total_action_value",
"unique_clicks",
"unique_ctr",
"website_purchase_roas")));
FBInsightsExpanded <- list.stack(list.select(FBInsightsExpanded, website_purchase_roas = website_purchase_roas$value));
** 编辑:建议的包列表和相关代码位
【问题讨论】:
-
我不知道你希望人们如何帮助你,当你提供来自一些未知包的函数的代码并且没有关于你为什么使用
<<-的上下文时。您需要创建一个可重现的最小示例。 -
更新/.......
标签: r data.table