Skip to content
This repository was archived by the owner on Mar 22, 2024. It is now read-only.

Commit 16ba702

Browse files
committed
be consistent with the simplify argument
1 parent b8e061e commit 16ba702

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

R/fb_ad.R

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,23 @@ fbad_list_ad <- function(fbacc, id, statuses, fields = 'id', simplify = TRUE) {
255255
)),
256256
method = 'POST')
257257

258+
## parse JSON
259+
res <- lapply(fromJSONish(res)$body, function(x) fromJSONish(x)$data)
260+
258261
## transform data part of the list to data.frame
259-
do.call(rbind, lapply(fromJSONish(res)$body,
260-
function(x) fromJSONish(x)$data))
262+
if (simplify) {
263+
res <- do.call(rbind, res)
264+
}
265+
266+
res
261267

262268
})
263269

264270
## return merged data.frame
265-
res <- do.call(rbind, res)
266-
rownames(res) <- NULL
271+
if (simplify) {
272+
res <- do.call(rbind, res)
273+
rownames(res) <- NULL
274+
}
267275
res
268276

269277
}

0 commit comments

Comments
 (0)