[R] send out put to file in R

Gábor Csárdi csardi at rmki.kfki.hu
Thu Jul 15 08:45:05 CEST 2010


On Thu, Jul 15, 2010 at 7:24 AM, chakri_amateur <chakri2sai at yahoo.co.in> wrote:
[...]
> wri write.graph ("F://new", "pajek") <-      decompose.graph(g,  mode="weak", max.comps=NA,
> min.vertices= 20)
>
>
> But even that doesn't work

No wonder, writing computer programs is not just typing in random
words and let the computer figure out what you are trying to do. At
least not yet.

> Is there a way in which I could convert my output to a graph ?

But you already have that in "test.net", no?

It would help if you could tell us what you are trying to do. If you
decompose a graph to components, you get a list of graphs; do you want
to save each component in a separate file? Then do this (untested):

for (i in seq_along(compo)) {
  write.graph(compo[[i]], file=paste(sep="", "new-", i, ".net"), format="pajek")
}

If you want to do something else, then please tell us.

Gabor

> Regards
> Chakri
>
> --- On Wed, 14/7/10, Peter Ehlers [via R] <ml-node+2288693-1191699815-309310 at n4.nabble.com> wrote:
>
> From: Peter Ehlers [via R] <ml-node+2288693-1191699815-309310 at n4.nabble.com>
> Subject: Re: send out put to file in R
> To: "chakri_amateur" <chakri2sai at yahoo.co.in>
> Date: Wednesday, 14 July, 2010, 6:23 PM
>
>
>
>
> On 2010-07-14 4:04, chakri_amateur wrote:
>
>>
>
>> Hi
>
>>
>
>> I am using igraph package in R.
>
>> My goal is to read  a network (in "pajek" format) and decompose the network
>
>> into components.
>
>> In addition, I am also interested in sending this output to to a file.
>
>>
>
>> I am having problem in while writing to a file!
>
>>
>
>> my code looks like this
>
>> g<- read.graph ("F://test.net", "pajek")
>
>> compo<- decompose.graph(g,  mode="weak", max.comps=NA, min.vertices= 20)
>
>> write.graph (compo, "F://new", "pajek")
>
>>
>
>> The error message shown up was -- "Not a Graph Object"
>
>>
>
>> Could any one explain what is the problem here ?
>
> Sure: compo is not an igraph object; it's a list as
>
> class(compo) or reading the help page for decompose.graph
>
> would tell you.
>
>
>    -Peter Ehlers
>
>
>>
>
>> Thanks
>
>> chakri
>
>
> ______________________________________________
>
> [hidden email] mailing list
>
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
>
>
>
>
>
> View message @ http://r.789695.n4.nabble.com/send-out-put-to-file-in-R-tp2288515p2288693.html
>
>
> To unsubscribe from send out put to file in R, click here.
>
>
>
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/send-out-put-to-file-in-R-tp2288515p2289690.html
> Sent from the R help mailing list archive at Nabble.com.
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>



-- 
Gabor Csardi <Gabor.Csardi at unil.ch>     UNIL DGM



More information about the R-help mailing list