嘿,伙计们,我有这个:
df<-data.frame(x1=c("0.25","0.4**","0.24"),
x2 = c("","0.72***","0.68*"),
x3 = c("","","0.75"))
rownames(df) <- c("X2","X3","X4")
df %>%
rownames_to_column() %>%
gather(key, values,-rowname) %>%
filter(values %in% "[*]")
ouput:
<0 linhas> (ou row.names de comprimento 0)
预期输出:
仅选择“重要”值 * ** *** ****
# | 行名 | 钥匙 | 价值观 |
---|---|---|---|
2 | X3 | x1 | 0.4** |
5 | X3 | x2 | 0.72*** |
6 | X4 | x2 | 0.68* |