我之前问过这个问题: 如何将应用函数的结果添加到现有数据框?
我想我可以用它作为模板,并且 unnest() 我的oddsratio测试结果到数据框。
这里有一些数字
thing<-matrix(c(33,2153,48,2528,1577,30335,66,1916,24,1162,15,910),nrow=6,byrow=T)
colnames(thing)<-c("SM","AE")
rownames(thing)<-c("a","b","c","d","e","f")
oddsratio(thing)
我希望如果我这样做:
oddsthing<-as.data.frame(thing)
oddsthing<-oddsthing%>%mutate(res=list(oddsratio(thing)))%>%unnest()
但它不会产生我希望的输出。
当我写
thing_list<-oddsratio(thing)
我可以在列表中看到四个元素:数据、度量、p.value、校正
如何从作为列附加到 SM AE 列右侧的列表中获取度量值和 pvalue?
如何访问列表中的内容?我可以 unnest($res) 但这也不起作用。
我有一种感觉,我快到了……
谢谢!