save program results and graphs to one file

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

save program results and graphs to one file

Ragia

Dear group,

I have many plots and numeric results in my R program,  kindly how can I save them all sequently on one file.
thanks in advance
RAI
     
        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: save program results and graphs to one file

Jeff Newmiller
In general this depends what you plan to do with those results. I suspect you are looking for something like knitr with rmarkdown (.Rmd files to create HTML or Word) or LaTeX (.Rnw files to create PDF).
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<[hidden email]>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.

On February 1, 2015 12:05:47 PM PST, Ragia Ibrahim <[hidden email]> wrote:

>
>Dear group,
>
>I have many plots and numeric results in my R program,  kindly how can
>I save them all sequently on one file.
>thanks in advance
>RAI
>    
> [[alternative HTML version deleted]]
>
>______________________________________________
>[hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: save program results and graphs to one file

Bert Gunter
But in addition to what Jeff noted, see ?save and ?save.image

(noting that that the resulting .Rdata file can only be read by R).

Cheers,
Bert

Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
Clifford Stoll




On Sun, Feb 1, 2015 at 12:26 PM, Jeff Newmiller
<[hidden email]> wrote:

> In general this depends what you plan to do with those results. I suspect you are looking for something like knitr with rmarkdown (.Rmd files to create HTML or Word) or LaTeX (.Rnw files to create PDF).
> ---------------------------------------------------------------------------
> Jeff Newmiller                        The     .....       .....  Go Live...
> DCN:<[hidden email]>        Basics: ##.#.       ##.#.  Live Go...
>                                       Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
> /Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
> ---------------------------------------------------------------------------
> Sent from my phone. Please excuse my brevity.
>
> On February 1, 2015 12:05:47 PM PST, Ragia Ibrahim <[hidden email]> wrote:
>>
>>Dear group,
>>
>>I have many plots and numeric results in my R program,  kindly how can
>>I save them all sequently on one file.
>>thanks in advance
>>RAI
>>
>>       [[alternative HTML version deleted]]
>>
>>______________________________________________
>>[hidden email] 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.
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: save program results and graphs to one file

Henrik Bengtsson-3
If you're happy with outputting to a multi-page PDF, then you can just
set the default graphics device to pdf(), i.e.

> options(device=pdf)

and the start plotting:

> plot(1:10, col=0)
> plot(10:1, col=1)
> plot((1:10)^2, col=2)
> plot((10:1)^2, col=3)

and at the end make sure to close the device:

> dev.off()

(The PDF device was automatically opened with the first plot call -
all other figures are appended to this one.)


This is what happens implicitly when you run a script in a
non-interactive session, e.g.

    Rscript -f myscript.R

That is, in that case you don't have to set the 'device' options (it's
done for you by default) and you don't have to close it at the end,
because that is also done for you by default.

/Henrik



On Sun, Feb 1, 2015 at 2:53 PM, Bert Gunter <[hidden email]> wrote:

> But in addition to what Jeff noted, see ?save and ?save.image
>
> (noting that that the resulting .Rdata file can only be read by R).
>
> Cheers,
> Bert
>
> Bert Gunter
> Genentech Nonclinical Biostatistics
> (650) 467-7374
>
> "Data is not information. Information is not knowledge. And knowledge
> is certainly not wisdom."
> Clifford Stoll
>
>
>
>
> On Sun, Feb 1, 2015 at 12:26 PM, Jeff Newmiller
> <[hidden email]> wrote:
>> In general this depends what you plan to do with those results. I suspect you are looking for something like knitr with rmarkdown (.Rmd files to create HTML or Word) or LaTeX (.Rnw files to create PDF).
>> ---------------------------------------------------------------------------
>> Jeff Newmiller                        The     .....       .....  Go Live...
>> DCN:<[hidden email]>        Basics: ##.#.       ##.#.  Live Go...
>>                                       Live:   OO#.. Dead: OO#..  Playing
>> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
>> /Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
>> ---------------------------------------------------------------------------
>> Sent from my phone. Please excuse my brevity.
>>
>> On February 1, 2015 12:05:47 PM PST, Ragia Ibrahim <[hidden email]> wrote:
>>>
>>>Dear group,
>>>
>>>I have many plots and numeric results in my R program,  kindly how can
>>>I save them all sequently on one file.
>>>thanks in advance
>>>RAI
>>>
>>>       [[alternative HTML version deleted]]
>>>
>>>______________________________________________
>>>[hidden email] 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.
>>
>> ______________________________________________
>> [hidden email] 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.
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: save program results and graphs to one file

Jim Lemon-4
Hi Ragia,
There are also the R2HTML and prettyR (see htmlize) packages that will
output an R session in HTML format.

Jim


On Mon, Feb 2, 2015 at 10:51 AM, Henrik Bengtsson <[hidden email]> wrote:

> If you're happy with outputting to a multi-page PDF, then you can just
> set the default graphics device to pdf(), i.e.
>
>> options(device=pdf)
>
> and the start plotting:
>
>> plot(1:10, col=0)
>> plot(10:1, col=1)
>> plot((1:10)^2, col=2)
>> plot((10:1)^2, col=3)
>
> and at the end make sure to close the device:
>
>> dev.off()
>
> (The PDF device was automatically opened with the first plot call -
> all other figures are appended to this one.)
>
>
> This is what happens implicitly when you run a script in a
> non-interactive session, e.g.
>
>     Rscript -f myscript.R
>
> That is, in that case you don't have to set the 'device' options (it's
> done for you by default) and you don't have to close it at the end,
> because that is also done for you by default.
>
> /Henrik
>
>
>
> On Sun, Feb 1, 2015 at 2:53 PM, Bert Gunter <[hidden email]> wrote:
>> But in addition to what Jeff noted, see ?save and ?save.image
>>
>> (noting that that the resulting .Rdata file can only be read by R).
>>
>> Cheers,
>> Bert
>>
>> Bert Gunter
>> Genentech Nonclinical Biostatistics
>> (650) 467-7374
>>
>> "Data is not information. Information is not knowledge. And knowledge
>> is certainly not wisdom."
>> Clifford Stoll
>>
>>
>>
>>
>> On Sun, Feb 1, 2015 at 12:26 PM, Jeff Newmiller
>> <[hidden email]> wrote:
>>> In general this depends what you plan to do with those results. I suspect you are looking for something like knitr with rmarkdown (.Rmd files to create HTML or Word) or LaTeX (.Rnw files to create PDF).
>>> ---------------------------------------------------------------------------
>>> Jeff Newmiller                        The     .....       .....  Go Live...
>>> DCN:<[hidden email]>        Basics: ##.#.       ##.#.  Live Go...
>>>                                       Live:   OO#.. Dead: OO#..  Playing
>>> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
>>> /Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
>>> ---------------------------------------------------------------------------
>>> Sent from my phone. Please excuse my brevity.
>>>
>>> On February 1, 2015 12:05:47 PM PST, Ragia Ibrahim <[hidden email]> wrote:
>>>>
>>>>Dear group,
>>>>
>>>>I have many plots and numeric results in my R program,  kindly how can
>>>>I save them all sequently on one file.
>>>>thanks in advance
>>>>RAI
>>>>
>>>>       [[alternative HTML version deleted]]
>>>>
>>>>______________________________________________
>>>>[hidden email] 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.
>>>
>>> ______________________________________________
>>> [hidden email] 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.
>>
>> ______________________________________________
>> [hidden email] 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.
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: save program results and graphs to one file

fonda99
In reply to this post by Ragia
With a little effort you could implement Rstudio and try RMD (R Markdown)
it is very proficient, look at
https://support.rstudio.com/hc/en-us/articles/200552086-Using-R-Markdown
Il 01/feb/2015 21:07 "Ragia Ibrahim" <[hidden email]> ha scritto:

>
> Dear group,
>
> I have many plots and numeric results in my R program,  kindly how can I
> save them all sequently on one file.
> thanks in advance
> RAI
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

creating matrix row by row

Ragia
 



Hi,
 I have a original adjacency  matrix  n X n , and I want to connect certain row with
 a set of other selected columns (could be not the same as in the
original matrix).
this in each iteration I have a new row of this connections matrix , how to create this matrix.
having original row number and the numbers of columns that will be connected to.

e.g.
   1 2 3 4 5
1  1 1 1 1 1
2  1 1 0 0 1
3
4
4

inf first iteration row 1 will have only connections to columns 2 and 5
and in secondly  row 2 will have only relation to column 2

how can I do this
thanks in advance

         
        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.