I have a dataset with 2 columns. I need to find which words connect dt$source == "learn4
in R.
The output is a vector c("learn2", "learn1", "learn")
First we have "learn4"
connected to "learn2"
,then "learn2"
connected to "learn1"
, then "learn1
connected to "learn"
I couldn't think any way to approach the problem. Any suggestion?
dt <- data.frame(source = c("learn","learn1", "disc","learn2","learn3","disc1","lb","learn4"),
new = c("learn","learn","disc","learn1","learn1","disc","lb","learn2"))
dt
source new
1 learn learn
2 learn1 learn
3 disc disc
4 learn2 learn1
5 learn3 learn1
6 disc1 disc
7 lb lb
8 learn4 learn2
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…