R-markdown error - cannot generate html file

I'm running R-markdown with command lines:

Rscript -e "rmarkdown::render('BRS_totalRNA.Rmd',output_file='BRS_totalRNA.html')"

my code worked fine until the last step, which is to generate the html file.

my code is like that:

---
title: "BRS"
author: "Jieqiong Dai"
date: "May 1, 2019"
output: html_document
---

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

```{r}
#calculate BRAS-RAS scoring
library(DESeq2)
#reads in total RNA reads count data
rna <- read.csv("/data/daij/project/Chernobyl_phase123/phase1234/corrected_read_count/totalRNA/phase1234_totalRNA_reads_count_ready.csv",header=T,row.names=1)
head(rna)
ncol(rna)
nrow(rna)

#read in sample table 
sample <- read.csv("/data/daij/project/Chernobyl_phase123/phase1234/corrected_read_count/totalRNA/tumorVSnormal/phase1234_totalRNA_sample_table_inuse.csv",header=T,row.names=1)
head(sample)
nrow(sample)
ncol(sample)

...

BRS3 <- TB3-TR3
BRS3 <- matrix(BRS3,ncol=1, byrow=T)
colnames(BRS3) <- c("BRS")
rownames(BRS3) <- colnames(top100c_vst_tu)  
write.csv(BRS3,"tumor_BRS_totalRNA_183_40.csv")


save.image("totalRNA_BRS.Rdata")

```

## Including Plots

You can also embed plots, for example:

```{r, echo=TRUE}

```

All the output data files were generated and the "totalRNA_BRS.Rdata" was successfully saved.

the error message is :

output file: BRS_totalRNA.knit.md

Error in file(con, "w") : cannot open the connection
Calls: ... pandoc_html_extras_args -> as_tmpfile -> write_utf8 -> writeLines -> file
In addition: Warning message:
In file(con, "w") :
cannot open file '/tmp/RtmpB2YFLy/rmarkdown-str9c2b4aaf8416.html': No such file or directory
Execution halted

I am using R/3.5.2.

Does any body have an idea about that?

Thanks!

This will be more obvious as an Rmd file in RStudio, but the problem is what does your script output?

Only

head(sample)
nrow(sample)
ncol(sample)

none of which are HTML, It's not even clear were totalRNA_BRS is derived.

My suggestion is to try this as an Rmd file in RStudio with knit to see exactly where you're missing information.

Thanks for your help.
My entire code takes more than 2 days to run and there is a time limit in my HPC system to run interactive jobs, so I cannot run it in Rstudio with knit directly.
I tried to break my code into 2 parts, and run them separately. Both of them work and create the final html files.
So it may be the issue with the /tmp directory of my HPC system. Do you think so?

I' m not familiar with HPC. The two part test does seem to point on /tmp limit. I'd ask your sysadm or IT help desk if it's possible to get a larger quota.

Thanks! The html was successfully created after I requested a larger quota for the /temp storage.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.