I need to extract specific information from a list in R. My data is 'Benford' object and doesn't seem to be coercible using as_tibble()
My data looks as follows:
library(dplyr)
library(purrr)
library(benford.analysis)
# read data
data = read.csv("https://www2.census.gov/programs-surveys/popest/datasets/2010-2019/counties/totals/co-est2019-alldata.csv", header = T)
# ONLY SELECT THE NUMERIC COLUMN
x <- data %>%
select(CENSUS2010POP)
# SPLIT THE DATA INTO TWO GROUPS
x$CITY <- "CITY_A"
x[1500:3193,2] <- "CITY_B"
# SPLIT THE DATA ON THE CITY VARIABLE
dat_list <- split(x,x$CITY)
# APPLY THE BENFORD ANALYSIS TO THE NUMERICAL VALUES PER GROUP
output <- map(dat_list, ~benford(number.of.digits = 1, discrete = TRUE, sign = "positive", data = .x$CENSUS2010POP))
I wish to create a data frame with the CITY
name i.e. CITY_A
in one column and the $ MAD.conformity
in another for each element in the list.
Any help on how I can pull these elements from my list and store them in a data frame?