[英]refrormating the output of print and save it as a data.frame in R
如果我們轉換成table
,可以使用melt
從reshape2
out <- reshape2::melt(as.table(fit3[[2]]))
head(out)
# Var1 Var2 value
#1 Q1 Factor1 0.22366038
#2 Q2 Factor1 0.17247766
#3 Q3 Factor1 0.13137496
#4 Q4 Factor1 0.05196747
#5 Q5 Factor1 -0.02885493
#6 Q6 Factor1 0.24943613
或者在base R
transform(subset(as.data.frame.table(fit3[[2]]), Freq >= 0.5),
Var2 = sub("\\D+", "", Var2))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.