Rmd - not giving erros but also no html output document

Hi,
I have a rmd project that runs completely without any error massage but doesn´t create any html output.
If I run new projects they create outputs. Yesterday I copied al the r code in a new rmd project and it created a output since them i only made minor changes in the r code. But since them I do not get any html output (rmd doesn´t give any error massage) the r code compiles without any erros or warnings.
I installed the newest version of rstudio but I still don´t get any output file.
What could be the error?
Thanks a lot in advance

Hi @Sch! Welcome!

Can you try the following?

  1. Try to render your problem .Rmd document using the Knit button.
  2. Go to the R Markdown tab (should have appeared in the same pane as Console), and copy everything there.
  3. In a new post, on a blank line, click the little </> button at the top of the posting box. This will insert a small template with the words “type or paste code here” selected.
  4. Paste the output from the R Markdown console, replacing the “type or paste code here” line in the template.


processing file: toyota8.Rmd
  |...                                                              |   5%
  ordinary text without R code

  |.......                                                          |  11%
label: setup (with options) 
List of 1
 $ include: logi FALSE

  |..........                                                       |  16%
  ordinary text without R code

  |..............                                                   |  21%
label: unnamed-chunk-1
  |.................                                                |  26%
  ordinary text without R code

  |.....................                                            |  32%
label: unnamed-chunk-2
  |........................                                         |  37%
  ordinary text without R code

  |...........................                                      |  42%
label: unnamed-chunk-3
  |...............................                                  |  47%
  ordinary text without R code

  |..................................                               |  53%
label: unnamed-chunk-4
  |......................................                           |  58%
  ordinary text without R code

  |.........................................                        |  63%
label: unnamed-chunk-5
  |............................................                     |  68%
  ordinary text without R code

  |................................................                 |  74%
label: unnamed-chunk-6
  |...................................................              |  79%
  ordinary text without R code

  |.......................................................          |  84%
label: unnamed-chunk-7
  |..........................................................       |  89%
  ordinary text without R code

  |..............................................................   |  95%
label: unnamed-chunk-8
  |.................................................................| 100%
  ordinary text without R code


output file: toyota8.knit.md

"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS toyota8.utf8.md --to html4 --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash+smart --output toyota8.html --email-obfuscation none --self-contained --standalone --section-divs --template "C:\Users\tobias\Documents\R\win-library\3.5\rmarkdown\rmd\h\default.html" --no-highlight --variable highlightjs=1 --variable "theme:bootstrap" --include-in-header "C:\Users\tobias\AppData\Local\Temp\RtmpOA9GYj\rmarkdown-str27286bd74ff6.html" --mathjax --variable "mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" 

So, the same file ".Rmd" plots a html on others computers.
What could be the issue? Any ideas?

It seems to compile correctly from what you posted as rendering log. You should find a toyota8.html inside the directory where you toyota8.Rmd is.
It is good news that it works elsewhere on other computer.
Maybe there is a tree of folder and your file is there somewhere :slight_smile:
Can you share the content of your rstudio project ? How it is organize ? Is your Rmd at the root of the project ?

Hi cderv,
thanks for your answer. Unfortunately I´m not getting a toyota8.html file. If I first knit to word (which is working fine) and then try html again I am getting a file called toyota8.utf8.md .
The content is a simple file to see the behaviour of linear regressions.
The code is the following:

---
title: "toyota8"
author: "t"
date: "23 11 2018"
output:
  html_document: default
  word_document: default
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## Tarea:
Importar desde CV el dataset ToyotaCorolla.csv.  
Analizar graficamente.  
Encontrar modelos de regresión lineal, polinómicos y ajustes entre varias variables (múltiple).  
Evaluar los modelos gráficamente y con los estimadores estadísticos vistos en clase.   
Subir los resultados por el CV.  

## Importar desde CV el dataset ToyotaCorolla.csv.
```{r}
 setwd("~/Master-Studium/R")
 library(readr)
library(dplyr)
 ToyotaCorolla <- read.csv("ToyotaCorolla.csv")
 View(ToyotaCorolla)
 attach(ToyotaCorolla)
```
## Analizar graficamente.
```{r} 
 pairs(ToyotaCorolla)
 pairs(ToyotaCorolla[c(1,2,3)])
 # Analizando los "plots" se ve una dependencia entre precio a KM y edad
```
## Encontrar modelos de regresión lineal, polinómicos y ajustes entre varias variables (múltiple).

### Primero: Price(km), comparando, dependencia linear, polinomia, logarimica
He encontrado que una regreccion de poli4 queda la mejor entre ellas:
```{r} 
 M1_Pri_Km_lin <- lm(Price ~ KM)   # modelo linear basico, price depende de KM
 summary(M1_Pri_Km_lin)
 
 M2_Pri_Km_Sq <- lm(Price ~ KM + I(KM^2))    # adding cubig dependency to the model M2_Pri_Km_Sq
 summary(M2_Pri_Km_Sq)
 
 M3_Pri_km_log <- lm (Price ~ log(KM)) # logaritmo natural
 summary(M3_Pri_km_log)
 
 M4_Pri_km_cub <- lm(Price ~ KM + I(KM^2)+I(KM^3)) 
 summary(M4_Pri_km_cub)
 
  M5_Pri_km_1overX <- lm(Price ~ KM + I(1/KM)) # no tan bueno como pensado
 summary(M5_Pri_km_1overX )
 
 M6_Pri_km_qua <- lm(Price ~ KM + I(KM^2)+I(KM^3)+I(KM^4)) 
 summary(M6_Pri_km_qua)
 
 anova(M1_Pri_Km_lin,M2_Pri_Km_Sq) # demustra que M2 es mejor
 anova(M2_Pri_Km_Sq,M4_Pri_km_cub) # demustra que M4 es todavia mejor
anova(M4_Pri_km_cub,M6_Pri_km_qua) # demustra que M4 es todavia mejor
 
 
 plot(KM, Price)        # plots grafic
 abline(M1_Pri_Km_lin)             # to plot linear line in actual plot
 
 par(new=TRUE)          # combine plots
 # plot(KM, predict(M2_Pri_Km_Sq,data.frame(x=KM)),col="red",  xaxt="n", yaxt="n", ylab="")
  # xaxt="n", yaxt="n", - no scales on axes
  # xlab="", ylab="", type="l")   -  no lables on axis
  # type= "l" - line
  # axis(side=4)   - adds a seccond y axis
 # or 
 x1=0:250000
  #plot(x1, predict(M2_Pri_Km_Sq,data.frame(KM=x1)), col="red")
 plot(x1, predict(M6_Pri_km_qua,data.frame(KM=x1)), col="red", xaxt="n", yaxt="n", ylab="")
 plot(M6_Pri_km_qua) # para ver el Modelo en graficos
 
 
```                      
### Price(age)
He encontrado que una regricion de poli2 queda la mejor entre ellas:
```{r}
 M1_Pri_Age_lin <- lm(Price ~ Age)   
 summary(M1_Pri_Age_lin)
 
 M2_Pri_Age_Sq <- lm(Price ~ Age + I(Age^2))   
 summary(M2_Pri_Age_Sq)
 
 M3_Pri_Age_log <- lm (Price ~ log(Age)) # logaritmo natural
 summary(M3_Pri_Age_log)
 
 M4_Pri_Age_cub <- lm(Price ~ Age + I(Age^2)+I(Age^3)) #R^2 menor q el de M2 -> demasiodos variables
 summary(M4_Pri_Age_cub)

 anova(M2_Pri_Age_Sq,M4_Pri_Age_cub) # Pr(>F) es grande -> M2 es mejor

```
### Combinacion Price(KM,Age)
voy a combinarinfluencia de Age es mucho mas grande que la de KM. Pero aun la combinacion de las dos da un resultado todavia mejor.
```{r}
 
M1_Pri_KmAge_cub <- lm(Price ~ KM +I(KM^2)+I(KM^3) +Age + I(Age^2))
summary(M1_Pri_KmAge_cub)

```
### Buscar mas variables interessantes
Haciendo un modelo linear de todas las filas, se ve (en summary) que HP tambien tiene una influencia al Price de un caracter linear.

```{r}
 M_All <- lm(Price ~ . , data = ToyotaCorolla) # todas las filas
 summary(M_All) # demuestra dependencia linear de HP
 plot(Price,HP)
 
 M1_Pri_HP_lin <- lm(Price ~ HP)
 summary(M1_Pri_HP_lin) 
 
 M2_Pri_HP_sq <- lm(Price ~ HP +I(HP^2))
 summary(M2_Pri_HP_sq) 
 
 anova(M1_Pri_HP_lin,M2_Pri_HP_sq) # comparar dos modelos ->M2 mejor
 
 #m5 <- lm(Price ~ . , data = ToyotaCorolla) # todas las filas
 #summary(m5)
  
```
### Add all 3 elements to the model
```{r}

M2_Pri_KmAgeHp <- lm(Price ~ KM +I(KM^2)+I(KM^3) +Age + I(Age^2)+HP +I(HP^2))
summary(M2_Pri_KmAgeHp) # R^2 of 0.86

anova(M1_Pri_KmAge_cub,M2_Pri_KmAgeHp) # M2 is better
coef(M2_Pri_KmAgeHp)                  # demuestra los coefficientes de la regression

```
### Analizar modelo graficamente
### Residual vs fitted:   
vemos que los residuals son equalmente (simetrical) distribuido por los fitted (esta bien)   
### Normal Q-Q
en la parte baja y alta hay una pequenia deviacion de la distribucion normal (a lo mejor podria ser mejorado)    
### Scale location
demuestra si los "residual" estan repatido equalmente por los "predictors" (una lina horizontal seria mejor, se podria mejorar)   
### Residual vs Leverage
no aparecen "outliers" con mucha influencia
```{r}
plot(M2_Pri_KmAgeHp)
```


If you create a new Rmd document with the same YAML (word output and html output), are you able to render it successfully in both formats?

Also, if you're knitting by using the knit button, try selecting "Knit to html"

Is there any message or error in the rmarkdown panel that should open when you try to knit?

The rmarkdown panel opens (if you mean what was discribed by jcblum as: R Markdown tab (should have appeared in the same pane as Console ),) But there is no error massage it just never finishes in the sense that there is no html output file.
Other files are kniting without any problems. Some only knit sometimes.Especially this one not on my computer, but on others without any changes.

Hi Mara thank you for your advices. I´m selecting "Knit to html"

Yes both work on other Rmd documents. But as soon as I copy e.g. toyota8 content I have the same problem as before. If I understood the meaning of render correct, the rendering is always successfull. I just don´t get an html output.

I think if you have nothing after the command for pandoc conversion, it means that the rendering is still happening. It is why you don't have a html output, because it is not yet created by pandoc. but what is taking so long... :thinking:

Wild guess: Are you in an offline environment ? or behind a proxy ?
If it needs somehow internet it could be long.

Otherwise, you should wait. How long did you wait until now ?
From the content of the R markdown panel you posted, it may be that the conversion to html is not finished.

3 Likes

If this advice doesn't work, can you link to a repo where you have the doc? That way we can try to reproduce what's happening!

3 Likes

I am in an offline enviroment and I was waiting several hours. (The word document i am getting after a few secconds).

here are my files:

Thanks a lot for your help

1 Like

I can knit your Rmd to HTML on my computer. However, I'm online and being offline may be at the crux of the issue.

After seeing the output where you got "stuck" in rendering and then skimming through the HTML TOC section of the "R Markdown: the Definitive Guide" book, I'm wondering if this could have to do with MathJax. If I'm reading things correctly, it looks like by default HTML R Markdown includes MathJax and looks for it at a default URL. Since you are offline, maybe that's causing the rendering to get stuck?

You can control the default in the YAML header. I'm guessing you might want to exclude it entirely? That would involve adding mathjax: null to the YAML header.

Read more about it here:

2 Likes

Although I also just saw this GitHub issue, which looks very much like what you are reporting:

2 Likes

Thanks a lot, yes it is exactly the same problem

I was finally able to update pandoc (I don´t know why, it didn´t work yesterday but today doing exactly the same) but now I am finally getting the HTML output!!!
Thanks a lot for your help

3 Likes

If your question's been answered (even if by you), would you mind choosing a solution? (See FAQ below for how).

Having questions checked as resolved makes it a bit easier to navigate the site visually and see which threads still need help.

Thanks

1 Like