"Loris Bennett" <loris.benn...@fu-berlin.de> writes:

> "Loris Bennett" <loris.benn...@fu-berlin.de> writes:
>
>> Hi,
>>
>> At the beginning of each month I generate a plot via a CALL to a block
>> of R code:
>>
>> #+CALL: code;plot_usage_historical_facet(type="users")
>>
>> The type is used as part of the name of the output file.  Today I got
>> the error:
>>
>> user-error: No :file header argument given; cannot create graphical result.
>>
>> I have certainly updated Org since the last time I tried to create the
>> plot and am now running version 8.3.2 (8.3.2-39-gd537a3-elpaplus).
>>
>> Is this (new) behaviour expected?  If, so what do I have to do to
>> generate a plot file with a name which is dependent on an argument?
>
> Looking at my code again, I think I may have been mistaken and this may
> never have worked as I describe above.
>
> Thus the question should be:
>
> Is it possible to have a variable as part of the :file specification?

To answer my own question:

Probably not, but in my case it isn't necessary.

In my R code I have:

  ggsave(filename=paste0("./usage_",type,"_historical_facet.pdf"),plot=p)

and this produces, as desired, an output file where the file name
depends on the argument passed by CALL, e.g.

  #+CALL: code;plot_usage_historical_facet(type="users")

What threw me was that you still need ':file' header but the name
specified there is irrelevant, e.g.

  #+HEADER: :file tmp.pdf

When the block is evaluated, the file I want with the correct,
argument-dependent name is created.  However I also get 'tmp.pdf', but
this file just seems to be an empty PDF shell without any pages.

So this seems to be a minor bug.  Maybe ':file' should be able to take
a value which indicates that the name of the file will come from within
the block.

Cheers,

Loris

-- 
This signature is currently under construction.


Reply via email to