[R] Function to save results

Priya Arasu galaxie2485 at yahoo.co.in
Wed Nov 1 15:56:40 CET 2017


Hi Eric,Thanks for the explanation. Is there a way to save the results automatically after the analysis gets over?. As I recently lost the results, because I didn't save the results. I don't want to run the sink or save command after the analysis is over rather run the command for saving the file before starting to run the analysis, so the file gets saved automatically after the script has finished running
Priya
 


    On Wednesday, 1 November 2017 7:53 PM, Eric Berger <ericjberger at gmail.com> wrote:
 

 Hi Priya,
You did not follow the logic of the pseudo-code. The sink("filename"), sink() pair captures whatever output is generated between the first sink statement and the second sink statement.You need (possibly) to do:
sink("C://Users//Priya// Desktop//Attractor analysis_all genes//synaptogenesis//attr. txt")
net <- loadNetwork("C://Users//Priya/ /Desktop//Attractor analysis_all genes//synaptogenesis// regulationof_dopamine_ signaling_submodule3.txt")attr <- getAttractors(net, type="asynchronous")
sink()
HTH,Eric


 
On Wed, Nov 1, 2017 at 4:10 PM, Priya Arasu <galaxie2485 at yahoo.co.in> wrote:

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]]



More information about the R-help mailing list