2
我已經從facebook api fbRads
中提取數據。下面是數據幀的樣本,我有:閱讀列表類似於數據框單元格的值
mydata <- fread('ID,ACTIONS
02,"list(action_type = c("link_click", "post_reaction", "page_engagement", "post_engagement"), value = c("1", "4", "5", "5"))"
03,"list(action_type = c("app_custom_event.fb_mobile_activate_app", "app_custom_event.fb_mobile_add_to_cart", "app_custom_event.fb_mobile_content_view", "app_custom_event.fb_mobile_purchase", "app_custom_event.fb_mobile_search", "app_custom_event.other", "like", "link_click", "mobile_app_install", "offsite_conversion.fb_pixel_add_to_cart", "offsite_conversion.fb_pixel_add_to_wishlist", "offsite_conversion.fb_pixel_lead", "offsite_conversion.fb_pixel_purchase", "offsite_conversion.fb_pixel_search", "offsite_conversion.fb_pixel_view_content", "post_reaction", "page_engagement", "post_engagement", "offsite_conversion", "app_custom_event"), value = c("994", "219", "1696", "9", "47", "425", "67", "2267", "37", "348", "53", "3", "7", "218", "3286", "145", "2479", "2412", "3915", "3390"))"
04,"NULL"
05,"list(action_type = c("app_custom_event.fb_mobile_activate_app", "app_custom_event.fb_mobile_add_to_cart", "app_custom_event.fb_mobile_content_view", "app_custom_event.fb_mobile_purchase", "app_custom_event.fb_mobile_search", "app_custom_event.other", "like", "link_click", "mobile_app_install", "offsite_conversion.fb_pixel_add_to_cart", "offsite_conversion.fb_pixel_add_to_wishlist", "offsite_conversion.fb_pixel_lead", "offsite_conversion.fb_pixel_purchase", "offsite_conversion.fb_pixel_search", "offsite_conversion.fb_pixel_view_content", "post", "post_reaction", "page_engagement", "post_engagement", "offsite_conversion", "app_custom_event"), value = c("1703", "188", "2233", "13", "155", "731", "229", "2568", "62", "303", "46", "7", "17", "257", "4433", "1", "473", "3271", "3042", "5063", "5023"))"')
我需要找到值app_custom_event.fb_mobile_purchase
針對每個ID。 ACTION列在每個單元格中包含兩個列表,即action_type
和value
。
這我期待的輸出是:
mydata <- fread('ID,app_custom_event.fb_mobile_purchase
02,"NULL"
03,"9"
04,"NULL"
05,"13"')
我需要用字典來獲取價值?任何方法將不勝感激。
非常感謝。 我已經通過這個包的文檔。沒有這樣的讀取功能可以給我表格格式的數據 –