Given the following configuration object:
sourceClust = list(
clust1 = list(
prop = 0.25,
Dim1 = list(
mean = 2,
sd = 0.05
) ,
Dim2 = list(
mean = 3,
sd = .1
)
),
clust2 = list(
Dim1 = list(
mean = 4,
sd = .1
),
Dim2 = list(
mean = 3,
sd = 0.2
),
prop = 0.75
)
);
Is there an elegant, functional way to extract the data in the following format?
clusterMeans = data.frame(Dim1=c(2,4),Dim2=c(3,3));
clusterSD = data.frame(Dim1 = c(0.05,0.1), Dim2 = c(0.1,0.2));
clusterProp = c(0.25, 0.75);
I understand that the above can be accomplished with some nested loops, but I'm trying to see if I can use functional styling to accomplish this task. I'm looking for a solution in base R or using a library (tidyverse is great).