Thanks for your reply but it does not solve the problem. Since I have 7 text rows in my df then I have to run something like

net2=graph(c("account","block","block","solve","solve","problem")) for each, I'm looking for a way to bring all the relations in one single plot

On Thursday, January 31, 2019 3:24 PM, Bill Poling <

[hidden email]> wrote:

Hello Elahe, this probably does not help but my idea may move you forward?

################################################################# NEW TOPIC ##############################################################################

#From: R-help <

[hidden email]> On Behalf Of Elahe chalabi via R-help Sent: Wednesday, January 30, 2019 5:16 AM

# I ran this

net1 <- structure(list(text = structure(c(1L, 7L, 3L, 4L, 5L, 6L, 2L), .Label = c("account block solv problem",

"exactly problem morning", "investigate similar problem", "matched problem control vec", "problem also accour yesterday", "same problem jj ", "same problem uk"

), class = "factor")), class = "data.frame", row.names = c(NA,

-7L))

#And I ran this

library(igraph)

net2=graph(c("account","block","block","solve","solve","problem"))

plot(net2)

# I do not get 7 plots, only one? See attached.

WHP

From: R-help <

[hidden email]> On Behalf Of Elahe chalabi via R-help

Sent: Wednesday, January 30, 2019 5:16 AM

To: R-help Mailing List <

[hidden email]>

Subject: [R] create a network for a small text df

Hi all,

I have a small dataframe and I would like to show in a network plot how words are related to the word "problem" with arrows (keeping the order of the words in sentences).

Here's the df:

dput(df)

structure(list(text = structure(c(1L, 7L, 3L, 4L, 5L, 6L, 2L), .Label = c("account block solv problem",

"exactly problem morning", "investigate similar problem", "matched problem control vec", "problem also accour yesterday", "same problem jj ", "same problem uk"

), class = "factor")), class = "data.frame", row.names = c(NA,

-7L))

So far I have tried plotting each row a a network as following:

library(igraph)

net=graph(c("account","block","block","solve","solve","problem"))

plot(net)

but I will end up having 7 plots, is there a better way?

thanks for any help.

Elahe.

______________________________________________

mailto:

[hidden email] mailing list -- To UNSUBSCRIBE and more, see

https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide

http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.

Confidentiality Notice This message is sent from Zelis. ...{{dropped:7}}

______________________________________________

[hidden email] mailing list -- To UNSUBSCRIBE and more, see

https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide

http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.