Hi,I want the results to be saved automatically in a output text file after the script has finished running. I used the sink function in the following example, but the results file (output.txt) was empty. net <- loadNetwork("C://Users//Priya//Desktop//Attractor analysis_all genes//synaptogenesis//regulationof_dopamine_signaling_submodule3.txt")# First I loaded theinput file for which I want to identify attractors attr <- sink("C://Users//Priya//Desktop//Attractor analysis_all genes//synaptogenesis//output.txt")# used the sink function to save the results from attr function attr <- getAttractors(net, type="asynchronous")# then ran the script for identifying attractors Is there any function to save the results before setting the script to run, so that results are automatically saved in a text file after the script has finished running? Thank youPriya [[alternative HTML version deleted]]
Some comments: 1. sink() does not return a value. There is on point to set attr <- sink(...). Just give the command sink("C://....etc") 2. to complete the saving to the file you must give a second sink command with no argument: sink() So your code would be (pseudo-code, not actual code) sink( "filename" ) do something that prints output which will be captured by sink sink() HTH, Eric On Wed, Nov 1, 2017 at 1:32 PM, Priya Arasu via R-help <r-help at r-project.org> wrote:> Hi,I want the results to be saved automatically in a output text file > after the script has finished running. > > I used the sink function in the following example, but the results file > (output.txt) was empty. > > net <- loadNetwork("C://Users//Priya//Desktop//Attractor analysis_all > genes//synaptogenesis//regulationof_dopamine_signaling_submodule3.txt")# > First I loaded theinput file for which I want to identify attractors > attr <- sink("C://Users//Priya//Desktop//Attractor analysis_all > genes//synaptogenesis//output.txt")# used the sink function to save the > results from attr function > > attr <- getAttractors(net, type="asynchronous")# then ran the script for > identifying attractors > Is there any function to save the results before setting the script to > run, so that results are automatically saved in a text file after the > script has finished running? > > Thank youPriya > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. >[[alternative HTML version deleted]]
Hi Eric,I tried as you suggested but I could not find the output in the text file I created (attr.txt) net <- loadNetwork("C://Users//Priya//Desktop//Attractor analysis_all genes//synaptogenesis//regulationof_dopamine_signaling_submodule3.txt")sink("C://Users//Priya//Desktop//Attractor analysis_all genes//synaptogenesis//attr.txt") sink() attr <- getAttractors(net, type="asynchronous") ?Priya On Wednesday, 1 November 2017 6:54 PM, Eric Berger <ericjberger at gmail.com> wrote: Some comments:1. sink() does not return a value. There is on point to set attr <- sink(...). Just give the command sink("C://....etc")2. to complete the saving to the file you must give a second sink command with no argument:? sink()So your code would be (pseudo-code, not actual code) sink( "filename" )do something that prints output which will be captured by sinksink() HTH,Eric On Wed, Nov 1, 2017 at 1:32 PM, Priya Arasu via R-help <r-help at r-project.org> wrote: Hi,I want the results to be saved automatically in a output text file after the script has finished running. I used the sink function in the following example, but the results file (output.txt) was empty. net <- loadNetwork("C://Users//Priya/ /Desktop//Attractor analysis_all genes//synaptogenesis// regulationof_dopamine_ signaling_submodule3.txt")# First I loaded theinput file for which I want to identify attractors attr <- sink("C://Users//Priya// Desktop//Attractor analysis_all genes//synaptogenesis//output. txt")# used the sink function to save the results from attr function attr <- getAttractors(net, type="asynchronous")# then ran the script for identifying attractors Is there any function to save the results before setting the script to run, so that results are automatically saved in a text file after the script has finished running? Thank youPriya ? ? ? ? [[alternative HTML version deleted]] ______________________________ ________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see 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. [[alternative HTML version deleted]]