ElMaestro ★★★ Denmark, 2016-03-06 00:14 (3306 d 13:37 ago) Posting: # 16055 Views: 8,481 |
|
Hi all, I am struggling a bit with R. Am trying to do something which sounds quite simple: I want to run some analyses in R and then create a document of sorts which may contain some of the results like graphs/plots, some tables, and a bit of text generated by R. Save in some easily accessible format like *.doc, *.rtf or pdf or anything widely used which can be opened/viewed by people who do not have R. It is not easy, though ![]() ![]() knitr and sweave and I am utterly and miserably lost. I admit that 250 tutorials and simple examples later I am none the wiser at all.Do I really have to copy and paste graphs, tables, text from R into a document manually? Or even worse, use disk i/o tools within R to create a folder from which I build manually a html document with the graphs and tables I produce. It seems a long and cumbersome way to go for very little, and at the end of the day it means the document (what the user sees via the browser) will still span several files and that is not ideal. If I could shell the browser to then print the html file to pdf via the built-in virtual pdf generator then it just might work. But this seems far-fetched, isn't there a smarter way? If someone has a quick way to accomplish what I so far haven't been able to then I'd love to see it. Thanks in advance for any input. Edit: Category changed. That’s perfectly On-Topic! [Helmut] — Pass or fail! ElMaestro |
d_labes ★★★ Berlin, Germany, 2016-03-06 14:25 (3305 d 23:27 ago) @ ElMaestro Posting: # 16056 Views: 7,244 |
|
Dear ÖbersterGrößterMeister, that is one of the shortcomings of R - report writing. No simple out of the box solution to get some simple report beside redirecting the output of R-scripts to text files ( ?sink ) or creating graphs in graph files and stick them together afterwards by hand ![]() The situation has changed if you use R-Studio, an IDE (integrated development environment for R programming, together with R markdown. Quote: "R Markdown is an authoring format that enables easy creation of dynamic documents, presentations, and reports from R. It combines the core syntax of markdown (an easy-to-write plain text format) with embedded R code chunks that are run so their output can be included in the final document. R Markdown documents are fully reproducible (they can be automatically regenerated whenever underlying R code or data changes)." IMHO the learning curve is nevertheless steep, means that "easy" from the quote is an euphemism for me, so I myself haven't used it up to now. But the description seems promising ![]() Here is another entry point, a simple tutorial for R Markdown. If you google you will find many more. Hope this helps. — Regards, Detlew |
Helmut ★★★ ![]() ![]() Vienna, Austria, 2016-03-06 16:57 (3305 d 20:54 ago) @ ElMaestro Posting: # 16059 Views: 7,261 |
|
Hi ElMaestro, my experiences and workflow: I don’t like the HTML produced by R (and *.html, *.doc, *.xls generated by commerical SW like Phoenix/WinNonlin as well). In many cases the HTML is not valid and/or contains a lot of inline-CSS. Awful. After import it takes ages to get the format right.
— Dif-tor heh smusma 🖖🏼 Довге життя Україна! ![]() Helmut Schütz ![]() The quality of responses received is directly proportional to the quality of the question asked. 🚮 Science Quotes |
yjlee168 ★★★ ![]() ![]() Kaohsiung, Taiwan, 2016-03-07 12:52 (3305 d 01:00 ago) @ ElMaestro Posting: # 16065 Views: 7,228 |
|
Dear Elmaestro, Have you looked at this (the package ReporteRs ), or this (the package R2DOCX )? Both seem not so bad.❝ ... ❝ Do I really have to copy and paste graphs, tables, text from R into a document manually? — All the best, -- Yung-jin Lee bear v2.9.2:- created by Hsin-ya Lee & Yung-jin Lee Kaohsiung, Taiwan https://www.pkpd168.com/bear Download link (updated) -> here |
ElMaestro ★★★ Denmark, 2016-03-07 14:36 (3304 d 23:16 ago) @ yjlee168 Posting: # 16067 Views: 7,090 |
|
Hi Yung-jin ❝ Have you looked at this (the package That is quite fantastic - the first option you provided seems to do the job. Thanks a lot ![]() — Pass or fail! ElMaestro |
Shuanghe ★★ Spain, 2016-03-07 18:38 (3304 d 19:14 ago) @ ElMaestro Posting: # 16069 Views: 7,123 |
|
Hi ElMaestro, What I have done is have a folder with the following sub folders as template. dat/ <-- data files I would just copy this template folder in a project location and use relative path in the source file such as read.csv("../dat/source.file.csv") so the analysis is portable. For important report that was intended for the boss ![]() For quick analysis to show it to colleagues then I would normally couple knitr with R markdown with html output. The learning curve of R markdown is nothing comparing to the learning curve of R, which you guys all seems mastered, so it shouldn't take long to be able to do most of analysis. ![]() Personally I think that knitr is a great tool. Once you have done a few analysis it wouldn't be very difficult to make some templates. The learning curve is also nothing comparing to R (It seems the more I study R the less I understood it). — All the best, Shuanghe |
d_labes ★★★ Berlin, Germany, 2016-03-08 08:49 (3304 d 05:03 ago) @ Shuanghe Posting: # 16073 Views: 6,973 |
|
Dear Shuanghe, ❝ ... The learning curve is also nothing comparing to R (It seems the more I study R the less I understood it). you are not alone ![]() — Regards, Detlew |