[R] Rstudio: is it possible to create a document out of a working script?
Jeff Newmiller
jdnewmil at dcn.davis.CA.us
Sat Jun 21 15:47:56 CEST 2014
As much as I admire RStudio for making these documentation formats easy to use, they did not invent any of them. The closest they came to that was hiring Yihui.
Having occupied our time with your questions, it would be polite if you closed the topic by explaining which approach you settled on and why.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> 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 June 21, 2014 2:05:08 AM PDT, Luca Cerone <luca.cerone at gmail.com> wrote:
>Dear all thank you very much for all the advices and help :)
>I think that Rstudio formats do what I need!
>
>
>
>2014-06-21 3:31 GMT+02:00 David Winsemius <dwinsemius at comcast.net>:
>>
>> On Jun 20, 2014, at 2:40 AM, Luca Cerone wrote:
>>
>>> Hi Berend, sorry if it OT (though I think that the process is pretty
>>> much Rstudio independent, since what Rstudio does is wrap up knitr
>and
>>> their package Rmarkdown,
>>> but all the process can be run from the shell).
>>>
>>> Bob, so far this is what I do, but it is not ideal for two reasons:
>>> 1. I would like my report to be a step by step guide of what the
>>> script does. Wrapping the scripts in small functions, subscripts
>>> doesn´t help,
>>> because in the report what you would see is "source("subscript.r"),
>>> not the content of the subscript.
>>
>> Have you looked at ?source and considered changing the associated
>option?
>>
>>> getOption("verbose")
>> [1] FALSE
>>
>>>
>>> 2. in a way I would need the exact opposite of what knitr and
>>> Rmarkdown do (at least by default). I would like to document my
>script
>>> in a way that can be run independently of the report and that, when
>>> neede, could use the comments to generate the report, similarly to
>how
>>> roxygen2 works when writing the documentation.
>>>
>>> Thanks a lot for the help,
>>> apologies again if this is OT (if so please remove the thread and I
>>> will ask in the the Rstudio support).
>>>
>>> Cheers,
>>> Luca
>>>
>>> 2014-06-20 11:28 GMT+02:00 Bob O'Hara <rni.boh at gmail.com>:
>>>> How about simply using source() to call the script? If necessary,
>wrap bits
>>>> of the script in functions, so you source a file with lots of
>functions, and
>>>> then call the ones you need, as you need them.
>>>>
>>>> Bob
>>>>
>>>> On 20 June 2014 11:20, Luca Cerone <luca.cerone at gmail.com> wrote:
>>>>>
>>>>> Dear all,
>>>>> I am very happy with the new features introduced by Rstudio about
>how
>>>>> to create documents embedding R code.
>>>>>
>>>>> I would like to know though if there is some way to embed code
>from a
>>>>> working script into an Rmd document.
>>>>> I have several working scripts for which I would like to report
>the
>>>>> results, but I would like to avoid
>>>>> copy and paste the code in the Rmd document: the pipeline is still
>a
>>>>> work in progress,
>>>>> and it is likely that I will end up changing the code and
>parameters
>>>>> in the script.
>>>>>
>>>>> As you can imagine, having to copy and paste my code is prone
>error,
>>>>> and leads to a lot of code replication.
>>>>> I would like to avoid this, but couldn´t find a straightforward
>way so
>>>>> far.
>>>>>
>>>>>
>>>>> Thanks a lot in advance,
>>>>> of course if you have other advices, or comments on best practices
>for
>>>>> this sort of thing,
>>>>> I would like to hear them from you.
>>>>>
>>>>> Cheers,
>>>>> Luca
>>>>>
>>>>> ______________________________________________
>>>>> R-help at r-project.org mailing list
>>>>> 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.
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Bob O'Hara
>>>>
>>>> Biodiversity and Climate Research Centre
>>>> Senckenberganlage 25
>>>> D-60325 Frankfurt am Main,
>>>> Germany
>>>>
>>>> Tel: +49 69 798 40226
>>>> Mobile: +49 1515 888 5440
>>>> WWW: http://www.bik-f.de/root/index.php?page_id=219
>>>> Blog: http://occamstypewriter.org/boboh/
>>>> Journal of Negative Results - EEB: www.jnr-eeb.org
>>>
>>>
>>>
>>> --
>>> Luca Cerone
>>>
>>> Tel: +34 692 06 71 28
>>> Skype: luca.cerone
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> 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.
>>
>> David Winsemius
>> Alameda, CA, USA
>>
>
>
>
>--
>Luca Cerone
>
>Tel: +34 692 06 71 28
>Skype: luca.cerone
>
>______________________________________________
>R-help at r-project.org mailing list
>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.
More information about the R-help
mailing list