I recently started to use Rmarkdown for generating my official documents. My documents need barplots as well as tables. I am accessing my tables through R code and generating Barplot out of these tables. But when I start to knit my document, it is halted due to barplot in it. When I remove the whole code for barplot and knit, the document is easily generated.
How can I solve this problem because I need these barplots in my document?
Related
I'm making a dynamic plot in R with ggplotly but I don't want it to be displayed in html file nor do I want to program it in RMarkdown. Is this possible?
I use Gnuplot for most of my plots and save the plots as a png. But the resolution of the plots are not so good to put in research papers. So, I need help regarding the following two things:
How to prepare publication-quality plots (eps) in Gnuplot?
How to use calligraphic fonts in the plot, like those written using \mathcal{} in latex?
I searched on the internet regarding these two things, but could not get any ideas.
Thanks in advance.
Since you are stating LaTeX code in your question, I suppose that a solution including LaTeX is suitable for you. I am using gnuplot for producing publication-quality plots (and even TOC-figures!) too, and for me the most convenient method is to use the cairolatex standalone terminal, use LaTeX syntax (e.g. \mathcal{}) in the labels, plot titles and so on, and to compile the figures with pdfLaTeX. Often enough, journals accept figures not only in .eps, but also in .pdf format. If a journal was to refuse .pdf, I would simply convert the figure in the end (i.e. right before submission) to .eps, .png or whatever.
I've created a R markdown notebook, to document the results from experiments. With increasing experiments and clinical data, the time to knit the document has increased significantly.
I create quite a number of plots, knit the document and share the HTML with my colleagues.
The question I have is: Is there a way to show the final plots in the way they appear in the HTML documents in RStudio without knitting the document?
It is a pain to try out different dimensions and having to knit the output again and again..
Or is trial and error the only way?
In the plots window, you can go to "Export > Save as Image"; this allows you to change the size of the plot in real time and see what it looks like. It's not quite perfect for this purpose as it shows the size of the plot in pixels, and you'll need it in inches for your Rmd, but you should be able to figure out what conversion is needed on your system. There is an Export > Save as PDF, as well, which does have the output size in inches, but doesn't allow you to resize the plot in real time, though it can "preview" a plot at a given size. Either way, you can play with the sizes of your plots this way (and know what those sizes are) without knitting the whole document.
That's the beautiful thing about R notebooks, you can run all the data analysis and wrangling in a previous R chunk, and then use the next chunk just as a visualization chunk to mess with dimensions. if you use this button it will only run the chunk NOT knit the whole document.
I have a code in R with a lot of plots. Copying those plots to a word document manually is too much work, so I am looking for some code that exports those plots directly to a word document. I have tried to use the officer package, but I do not understand it well. I think that with a simple example it will be easier to understand it for me.
For example, suppose I have a code with two easy plots:
plot(1,2)
plot(0,0)
How can I create a word document in which this two plots appear? Thank you very much!
According to this question/answer: gridExtra Colour different rows with tableGrob, gridExtra does not have the ability to highlight specific rows in the grid.table.
What then can be done to plot a table with specific row highlighting. Is there a better table package on CRAN?
Is the only solution to build the table up from its component rectangles, lines and labels?
Edit:
The output needs to be an image. I am using rmarkdown and html/TeX rendering of markdown tables are inconsistent, and TeX tables are usually too big for good beamer slides, plus you can't control the size (except using \tiny etc). I'm not at liberty to alter the beamer default file, and so the only real work around is to do tables as images, then you can specify the size etc.