How to setup R with LyX? - r

I wish to setup R with LyX. Going through the web I found many resources.
The "official" text doesn't seem to be the most up to date: http://wiki.lyx.org/LyX/LyxWithRThroughSweave
I followed most of the steps here: http://wiki.lyx.org/uploads/LaTeX/SweaveR/lyx_with_r_and_sweave_instructions.pdf
But was it really needed? Or is LyX 2.x makes some of them obsolete?
From reading this post: http://yihui.name/en/2011/05/sweave-and-pgfsweave-in-lyx-2-0-x-experimental/
I was not so sure anymore.
So my question is - what is the most up to date explanation on how to set up and use LyX with R?
Also - what editor do you find it useful to work with in combination with LyX?
Thanks.

I use LyX 2.0 with Sweave and pgfSweave on a daily basis. LyX 2.0 comes loaded with a module called Sweave which immediately allows you to use Sweave in your documents. If you plan to use pgfSweave, you need to (a) download the pgfSweave module and (b) install some converters. Details are available in the third link you indicated.
Hope this helps.

Related

Converting Docx to PDF using .Net Core [Open Source]

I'm looking for a plugin which can convert word (docx / doc) to pdf Without Microsoft.Office.Interop and Open Source one. There are questions asked on it but no solution is provided or I didnt found any.
Any suggestion or references will be much appreciated!.
You could do this using Aspose.Words project, however this library is not an opensource (license is required and cost some money): https://blog.aspose.com/2020/01/02/convert-word-doc-docx-to-pdf-in-csharp-net-core/
On our project we needed to keep formating as close as the original. But every plugin we tried never came close to the original.
We opted for I Love Pdf utilities.
Word to PDF
They have a well documented API for some language (including .Net) and it works great.
You can process 250 files freely every month and if you need more, it's not that expensive.
Hope this helps

R shiny or Rmarkdown user comments like in Word or Google Docs

I want to create a product/project documentation in R that is going to be reviewed and discussed by a group of reviews. There are plenty of examples of how to create book-like documents using Rmarkdown (e.g. https://bookdown.org/) or interactive data visualizations using R-shiny. However, I could not find any solution for user comments similar to LibreOffice Writer, MS Word, or Google Docs. I could also imagine having a split-pane where one side is dedicated to the content presentation (e.g. text, graphs, code), while the other side is left for comments.
I am aware that such a solution requires a server-side solution for storing comments.
Any hints on existing solutions, workarounds, and implementations are welcome.
If I correctly understood, your question isn't very R specific. R is just code, R files are just text and they don't allow comments (beside the raw hashtag comments) and reviews. Your question is more about version control environments, that allow reviews on code stuff. The most used version control system is git, and git has an integrated panel in RStudio.
Git allows you to split your developpements in branches, which are the different ideas you and your coworkers can work on independentely. Once an idea is finalised, after some consecutive modifications known as commits, it is to be asked for merge in the "main branch". It is a "pull request".
That is where the different platform using git, like GitHub or GitLab, allow some review systems. Basically, when a branch is done, you ask "is that ok ?". Your reviewer can see the changes, can try you things, and tell if that is actually ok.
The other advantage of these is the continuous integration, that is : elaborating tests (in R with testthat) that will be tested on some events merge, like "on each merge to master". It is meant to ensure that the software is going forward : if a merge breaks some earlier test, you'll know it.
For beginners, in order to avoid being lost in bash commands, GitHub Desktop is a fine GUI above Git.
Note : You can also rely on the package usethis which has a few helper functions like use_git, use_gitlab_ci, use_github_action... It's not specific to reviews and comments but to the gitlab and github integration

Julia's equivalents to R's help pages and vignettes?

Coming from an R background, and just started learning Julia, I wonder how's documentation in Julia, and if there are analogues to R's help pages and vignettes.
Furthermore, in R, one can document functions using roxygen comment blocks, is there also something similar in Julia?
I think it is best to understand how things work by example. I will comment on how DataFrames.jl is documented as this is a pretty standard approach:
Functions are documented using docstrings, here is an example of a docstring of function names; These docstrings are then discoverable interactively via help system (by pressing ?)
A standard way to generate a documentation for a package is to use Documenter.jl; by the way: the package has a great team of maintainers who are very helpful and responsive; here you have a link to the make.jl file that is executed to generate the documentation; note in particular the option doctest=true which makes sure that all code examples that are properly anoteted following Documenter.jl rules are producing an expected output
In order to set-up auto-generation of package documentation you need to set up CI integration on GitHub; again - there are many ways to do it; a standard one is to use GitHub Actions; here you have a link to the part of the ci.yml specification file that ensures that documentation is built as a part of CI; then in any PR, e.g. this one (I am giving a link to a currently open PR that is documentation related) you can see in the section reporting CI results that after running tests also documentation was generated. Here you can see how a documentation generated using this toolchain looks like (e.g. note that at the bottom you can switch the version of the package you want to read manual of dynamically which shows you that all here is really well integrated - not just a bunch of PDF or HTML files).
I hope this will help you to get started. I have pointed you to all essential pieces that are normally used by packages hosted on GitHub (i.e. this is not the only way to do it, but it is a standard way most commonly used).
To master all the details of the above you need to read the documentation in the Julia Manual and Documenter.jl carefully. Unfortunately writing a proper documentation is not easy (in any programming language). The good thing is that Julia has a really excellent toolchain that supports this process very well.

Best way to collaborate with manager on R Markdown reports?

I'm producing plenty of analyses in R and utilizing the .html Markdown format to present and communicate work. Often, my manager will need to correct/add to the text which accompanies the code blocks, and has practically no interaction with the code blocks. The analyses are typically produced by myself alone, so code collaboration is a low priority.
In an ideal world, he could open up the .html and edit the text in a browser, which I understand is not possible.
Are there any simple solutions for this? I am sure this is a common problem so there must be an easy solution I am overlooking. Here are the current solutions being considered:
Use Git (but my manager wouldn't like to learn Git)
Use Jupyter Notebooks (but I would prefer to stick with R Markdown for integration with RStudio and for the reproducible templates)
Knit the Markdown as a word document with manual version control on a shared network, allow tracking of changes in the word document, and copy-and-paste over changes made to the .Rmd file
The latter is least elegant but most likely to be used at the moment. If you have any suggestions, please let me know!
Here's a solution that is tailor-made your exact situation.
Use jupytext for bi-directional lossless interoperability between jupyter notebooks and R Markdown documents!
Maybe redoc is an option for you. Haven't tried it myself and it's still experimental but it would allow you to collaborate via Word. Basically the Word document can be edited and passed back to RMarkdown with all changes. See here.
I suggest you try trackdown https://claudiozandonella.github.io/trackdown/
trackdown offers a simple answer to collaborative writing and editing of R Markdown (or Sweave) documents. Using trackdown, the local .Rmd (or .Rnw) file is uploaded as plain-text in Google Drive where, thanks to the easily readable Markdown (or LaTeX) syntax and the well-known online interface offered by Google Docs, collaborators can easily contribute to the writing and editing of the narrative part of the document. After integrating all authors’ contributions, the final document can be downloaded and rendered locally.
Moreover, you can hide code chunks setting hide_code = TRUE (they will be automatically restored when downloaded). This prevents collaborators from inadvertently making changes to the code that might corrupt the file and it allows collaborators to focus only on the narrative text ignoring code jargon.
You can also upload the actual Output (i.e., the resulting complied document) in Google Drive together with the .Rmd (or .Rnw) document. This helps collaborators to evaluate the overall layout, figures and tables and it allows them to use comments on the pdf to propose and discuss suggestions.

Is it possible to get code completion for R in Emacs ESS similar to what is available in Rstudio?

Rstudio has a great code completion feature. It provides a quick view of functions that start with a given string, as well as function and parameter definitions.
ESS is powerful enough, familiar to me, and integrated into Emacs, where I conduct most of my work - so I am hesitant to move, but this feature is making me consider such a move.
Is it possible to integrate this feature into Emacs ESS?
Is there anything similar to this for Emacs ESS?
Any hope that there will be (and if so, how could I support such an effort?)
You do get the completion thanks to the rcompgen package by Deepayan (now "promoted" into base R as part of the utils package). So when I type
lm(
and hit TAB a new buffer opens which gets me the left-hand side of your window above: the available options to the function at hand. I don't think you can show the help directly though.
There is / was also a way to get context-sensitive help in the mini-buffer when typing but I have forgottten how/where that gets turned on.
[EDIT: This is an old answer and auto-complete package dropped out of fashion since then. Please use company-mode instead. It should work by default. Wiki configuration entry is here.]
Recent versions of ESS (> v.12.02) integrate with auto-complete package out of the box (you need not configure anything, just install auto-complete). It provides help on arguments as well as function help. I added detailed instructions to the wiki
Ess-eldoc was also rewritten and from v.12.02 it's active by default, so you don't need to configure anything.
Or maybe we should all use search:
Emacs autocomplete-mode extension for ESS and R
I don't want to be grumpy, I found this few hours ago and I'm still shocked. It works like a charm. Though I still prefer the old-style pop-ups. =)

Resources