
#Task 2.b
# Function to unnest data frames recursively

#source in 2a before
source("/Users/alexanderunger/Desktop/AIDAHO_IDS_THAS/02_code/R/api/2a.R")

unnest_dataframes <- function(x) {
  y <- do.call(data.frame, x)
  if ("data.frame" %in% sapply(y, class)) {
    return(unnest_dataframes(y))  # Recursively call unnest_dataframes if any columns are data frames
  }
  return(y)  # Return the flattened data frame
}


job_postings_unnested <- unnest_dataframes(job_postings)



