

Run this chunk of code as a pre-processing step before executing the main solution: idx <- which(sapply(x, function(k) is.null(k$relationships$websites$items$properties.url))) You would need to remove corrupted elements from input data where website_type has one value but properties.url has NULL.

Names = c("uuid",Įrror in (function (., row.names = NULL, check.rows = FALSE,Ĭheck.names = TRUE, : arguments imply differing number of rows: 1, "facebook", "twitter"), properties.url = c(""".Names = c("properties.website_type",

"relationships")), structure(list(uuid = "987", relationships = structure(list( Names = c("properties.website_type", "properties.url" Websites = structure(list(items = structure(list(properties.website_type = c("homepage", Which gives uuid facebook homepage linkedin twitterġ 123 2 987 Sample data: x <- list(structure(list(uuid = "123", relationships = structure(list( #convert list to dataframe in long format I tried a lot of different things with a combination of lapply(), spread(), and row_bind(), yet didn't manage to make anything work. Meaning: I would like to have every uuid (a unique firm identifier) in a single column, followed by the urls of the different platforms (fb, twitter.). Uuid web.url web.facebook web.twitter web.linkedin $ properties.url : chr "" "" "" ""Ĭonsider the following minimal example: x x.df $ properties.website_type: chr "homepage" "facebook" "twitter" "linkedin" I currently have the following problem: I extracted some data via the crunchbase API, resulting in a big nested list of the following structure (there are many more nested lists on several instances included, I here only display the part of the structure currently relevant for me): > str(x])
