in R/ad_data.R [155:177]
ad_row <- function(row) {
columns <- c(
"ad_creation_time", "ad_creative_body", "ad_creative_link_caption",
"ad_creative_link_description", "ad_creative_link_title",
"ad_delivery_start_time", "ad_delivery_stop_time", "currency",
"funding_entity", "page_id", "page_name", "spend_lower", "spend_upper",
"adlib_id", "impressions_lower", "impressions_upper",
"potential_reach_lower", "potential_reach_upper", "ad_snapshot_url"
)
for (field in columns) {
if (is.null(row[[field]])) {
row[[field]] <- NA
}
}
row[["spend_lower"]] <- as.numeric(na_pad(row[["spend"]][["lower_bound"]]))
row[["spend_upper"]] <- as.numeric(na_pad(row[["spend"]][["upper_bound"]]))
row[["adlib_id"]] <- adlib_id_from_row(row)
row[["impressions_lower"]] <- as.numeric(na_pad(row[["impressions"]][["lower_bound"]]))
row[["impressions_upper"]] <- as.numeric(na_pad(row[["impressions"]][["upper_bound"]]))
row[["potential_reach_lower"]] <- as.numeric(na_pad(row[["potential_reach"]][["lower_bound"]]))
row[["potential_reach_upper"]] <- as.numeric(na_pad(row[["potential_reach"]][["upper_bound"]]))
row[columns]
}