Save printed/plotted output to different directory

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

Save printed/plotted output to different directory

Rich Shepard
   I run analyses in one directory and keep images and textual output in
other directories. My test involving a pdf output specifying an output
directory relative to the cwd produced a blank image. The command was like
this:
pdf('../images/filename.pdf')

   Will R accept an absolute path to an output directory or none at all?

TIA,

Rich

______________________________________________
[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 printed/plotted output to different directory

Bert Gunter-2
Don't post. Try it and see.

-- Bert


On Wed, Sep 12, 2018 at 9:21 AM Rich Shepard <[hidden email]> wrote:

>
>    I run analyses in one directory and keep images and textual output in
> other directories. My test involving a pdf output specifying an output
> directory relative to the cwd produced a blank image. The command was like
> this:
> pdf('../images/filename.pdf')
>
>    Will R accept an absolute path to an output directory or none at all?
>
> TIA,
>
> Rich
>
> ______________________________________________
> [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 printed/plotted output to different directory

Rich Shepard
On Wed, 12 Sep 2018, Bert Gunter wrote:

> Don't post. Try it and see.

Bert,

   Tried using both $HOME and the full path without success and wondered if
there was a way to direct output to a different directory that hadn't
occurred to me.

Rich

______________________________________________
[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 printed/plotted output to different directory [ANSWERED]

Rich Shepard
On Wed, 12 Sep 2018, Rich Shepard wrote:

> Tried using both $HOME and the full path without success and wondered if
> there was a way to direct output to a different directory that hadn't
> occurred to me.

   Found the glitch. Now it works using relative paths.

Rich

______________________________________________
[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 printed/plotted output to different directory

Bert Gunter-2
In reply to this post by Rich Shepard
Insufficient info to diagnose. No code for what you did.

-- Bert


On Wed, Sep 12, 2018 at 9:43 AM Rich Shepard <[hidden email]> wrote:

>
> On Wed, 12 Sep 2018, Bert Gunter wrote:
>
> > Don't post. Try it and see.
>
> Bert,
>
>    Tried using both $HOME and the full path without success and wondered if
> there was a way to direct output to a different directory that hadn't
> occurred to me.
>
> Rich
>
> ______________________________________________
> [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 printed/plotted output to different directory

Jeff Newmiller
In reply to this post by Bert Gunter-2
Yes. I do it all the time.

On September 12, 2018 9:26:41 AM PDT, Bert Gunter <[hidden email]> wrote:

>Don't post. Try it and see.
>
>-- Bert
>
>
>On Wed, Sep 12, 2018 at 9:21 AM Rich Shepard <[hidden email]>
>wrote:
>>
>>    I run analyses in one directory and keep images and textual output
>in
>> other directories. My test involving a pdf output specifying an
>output
>> directory relative to the cwd produced a blank image. The command was
>like
>> this:
>> pdf('../images/filename.pdf')
>>
>>    Will R accept an absolute path to an output directory or none at
>all?
>>
>> TIA,
>>
>> Rich
>>
>> ______________________________________________
>> [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.

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[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 printed/plotted output to different directory

Jim Lemon-4
In reply to this post by Rich Shepard
Hi Rich,
Sometimes an empty image is due to not closing the image file. If you
forgot to put:

dev.off()

after the plotting commands, or there was an error in the plotting
commands, the file may be left open. Try manually entering "dev.off()"
after you have run the code. If you don't get an error:

Error in dev.off() : cannot shut down device 1 (the null device)

it means that you had an open device.

Jim

On Thu, Sep 13, 2018 at 2:21 AM Rich Shepard <[hidden email]> wrote:

>
>    I run analyses in one directory and keep images and textual output in
> other directories. My test involving a pdf output specifying an output
> directory relative to the cwd produced a blank image. The command was like
> this:
> pdf('../images/filename.pdf')
>
>    Will R accept an absolute path to an output directory or none at all?
>
> TIA,
>
> Rich
>
> ______________________________________________
> [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 printed/plotted output to different directory

Rich Shepard
On Thu, 13 Sep 2018, Jim Lemon wrote:

> Sometimes an empty image is due to not closing the image file. If you
> forgot to put:
>
> dev.off()
>
> after the plotting commands, or there was an error in the plotting
> commands, the file may be left open. Try manually entering "dev.off()"
> after you have run the code. If you don't get an error:

Jim,

   I thought of this and entered dev.off() a couple of times, to no avail.
Then I quit R and restarted it. That cleared the problem.

   A typo slipped in the script elsewhere when I modified the path for the
output PDF file. That probably jammed the device. Fixing the typo did not
address the constipation it caused, but killing the process and starting it
again did the job.

   Thanks for the information!

Best regards,

Rich

______________________________________________
[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.