RStudio notebook does not show data.frames when I compile - r

I have a temporary windows 7 laptop (32 bit) on which I have R 3.3.2 and RStudio 1.0.44.
I am using RStudio notebook, and it works fine when I execute code in its window. However, as I compile to html (pressing Preview), the data.frames disappear (there is a chunk with no output). Everything else (vectors or figures) are shown.
It seems to be linked to the new cute printing format for data.frames that the notebook exploits. Indeed, if I use R-markdown (switching to output: html_document), the data.frames are shown with no problem in the basic R format.
Any help is appreciated.

For the ones having this problem, it turned out the issue was related to rmarkdown 1.2.
I solved installing rmarkdown 1.1:
remove.packages("rmarkdown")
library(devtools)
install_version("rmarkdown", version = "1.1",
repos = "http://cran.us.r-project.org")
Then everything worked.

Related

R Notebook - code chunk gets separated in preview

I am using R notebook to preview the file. Even though all the code is in one chunk, a line gets separated into two. Would you please tell me how I can resolve this?
As you can see all the code is in one chunk.
However, when I run this chunk, it gets separated into two.
I am not sure if it matters but here is the code I am running.
library(MASS)
par(mfrow=c(3,1))
hist(galaxies, breaks=500)
hist(galaxies, breaks=100)
hist(galaxies, breaks=50)
Also here are the versions of R and RStudio. I an new to R so I am not sure what is causing this. If you need any other information, please let me know. Thanks
R version 3.3.2 (2016-10-31)
Rstudio version 1.0.136

Unable to get plots displayed in Rstudio graphical viewer.

When I run my code all my graphs (both ggplot2 and plot) are displayed in an external "Quartz 2 [*]" graphical viewer.
I would like them to be displayed in the R studio GUI plot area to I can better save and view my files, along with the previous versions.
Is there anyway to stop this?
I recently updated my version of R, along with the X11 and xQuartz on my mac (also up to date), and I am guessing these updates are behind it.
I have seen many forums explaining how to get rstudio to export to an external viewer (e.g. "quartz()"), but not the other way.
I have looked, but these threads have not helped:
ggplot plots in scripts do not display in Rstudio
plot panel does not produce plots Rstudio
dev.off() even when hidden hide <- dev.off() is not working either.
Any help would be great,
Thanks.
If you upgrade R without upgrading RStudio, the graphics engine may not be compatible. To fix the "Quartz 2" popout, upgrade RStudio to a newer version that supports the graphics engine in the version of R you have installed.
I had the same problem, and noticed the following output to the console:
Warning message:
R graphics engine version 15 is not supported by this version of RStudio. The Plots tab will be disabled until a newer version of RStudio is installed.
Looks like I forgot to reinstall Rstudio as well.. That sorted my problem.

compiling legacy Sweave with RStudio 0.99.902

I'm having multiple problems with the “sos” vignette in the “sos” package that has been on CRAN since 2009. I recently noticed that it fails in multiple ways, and I can't figure out how to fix several of the problems. "Compile PDF" on “sos.Rnw” in RStudio with R 3.3.0 under Mac OS X 10.11.5 produced an XQuartz pop-up as follows:
>Sweave Noweb Syntax?
>>It seems you are using the Sweave-specific syntax in line(s)
>>9, 15, <snip>; you may need Sweave2knitr("sos.Rnw") to
>>convert it to knitr'.
I did the following, as it asked:
Sweave2knitr('sos.Rnw')
This produced a file 'sos-knitr.Rnw'. I opened this file in RStudio and clicked 'Compile PDF'. I got one line only:
>Loading required package: knitr"
If I got anything else, I don't know where it went.
Any suggestion on how I can get past this?
Thanks, Spencer Graves
RStudio is using knitr by default instead of sweave to generate the code. Revert this decision by doing the following:
RStudio:
Tools -> Global Options -> Sweave -> Weave Rnw files using: Sweave

Syntax highlighting for Python chunks does not work

I'm trying to create notebooks in which I present the same algorithm written in R and Python. I can easily integrate the R and Python code in a Rmd file and then create a HTML output using the 'Knit HTML' button in RStudio. However the Python code is always displayed without syntax highlighting (not like in the example at https://github.com/yihui/knitr-examples/blob/master/023-engine-python.md). I have Andre Simon's highlight software installed and functioning on my computer (MacBook Pro Retina, MacOS X 10.9).
Currently, I have the following libraries installed in R: markdown 0.6.4, knitr 1.5.15, highr 0.3.1.
Any idea what could be the problem? Thanks for your help!.
That is specific to the RStudio Markdown render, which did not enable syntax highlighting for code blocks that are not R or C++. RStudio uses highlight.js, and you can use your own version of highlight.js to highlight Python code. Or use other Markdown converters such as Pandoc.

How do I get RStudio to publish R-markdown to the rpubs.org site?

According to a response from the RStudio team, the "standard" solution would be to follow the instructions for "Using R Markdown with RStudio", and notice the button on the third screenshot with the "Publish" button. A wonderfully simple solution that I'm quite grateful they have built.
However, the "Publish" button with the nice arrow and picture of the earth doesn't show up in my preview window, no matter how badly I want it to.
I am using RStudio (RStudio.version() 0.96.231) in Mac OS X Lion (10.7), with latest R version and updated markdown and knitr packages. I have an RPubs account, and have followed the RPubs instructions for creating and previewing the html rendered from an R markdown file from within RStudio.
This seems to be related to a post on the RStudio support blog about not-seeing a Publish button.
However, this question is different, as it requires actually getting content up onto RPubs. I have posted an analogous question on the RStudio Support blog.
The Rstudio team already answered how to get graphics embedded in html rendered by RStudio from R Markdown source; especially by pointing me to this extremely useful page explaining the way RStudio renders and packages R Markdown using knitr:
Using RStudio to render R Markdown
Finally, if you haven't heard about R-markdown (I just learned of it),
go here for details about R-markdown.
Confirmed by Josh Paulson at RStudio, this was a bug with RStudio in OS X Lion and not some weird extra set of unstated dependencies or unclear instructions.
Just install v0.96.233 or greater and this should work on Mac OS X Lion (10.7).
Actually, the implementation and instructions are quite straightforward.

Resources