Running ‘test.create_chunks.R’
  Running ‘test.data_encode_decode.R’
  Running ‘test.large_data_chunk.R’
Running the tests in ‘tests/test.create_chunks.R’ failed.
Complete output:
  > # Use a temporary directory ----------------------------
  > owd = getwd()
  > td = tempdir(check=TRUE)
  > setwd(td)
  > 
  > # Test --------------
  > library(knitrdata)
  > library(magrittr) # For pipe operator
  > 
  > # Create new Rmarkdown document
  > if (file.exists("test.create_chunks.Rmd"))
  +   file.remove("test.create_chunks.Rmd")
  > rmarkdown::draft("test.create_chunks.Rmd","github_document","rmarkdown",
  +                  edit=FALSE)
  > 
  > # Create some binary data
  > x = data.frame(a=1:10,b=(1:10)^2)
  > saveRDS(x,"test.create_chunks.RDS")
  > 
  > # Push chunks into Rmarkdown document
  > # Insert in reverse order to not have to figure out line number
  > txt = create_chunk("x\nplot(b~a,data=x)",chunk_type="r") %>%
  +   insert_chunk(11,rmd.file="test.create_chunks.Rmd")
  > txt = data_encode("test.create_chunks.RDS","base64") %>%
  +   create_chunk(output.var="x",format="binary",loader.function=readRDS) %>%
  +   insert_chunk(11,txt)
  > txt = create_chunk("library(knitrdata)",chunk_type="r") %>%
  +   insert_chunk(11,txt)
  > 
  > writeLines(txt,"test.create_chunks.Rmd")
  > 
  > # List all chunks in documents
  > chunklst = list_rmd_chunks(file="test.create_chunks.Rmd")
  > chunklst
    type    label start end
  1    r    setup     6   8
  2    r             11  13
  3 data             14  20
  4    r             21  24
  5    r     cars    32  34
  6    r pressure    40  42
  > 
  > # Remove the pressure chunk
  > xx = split_rmd_by_chunk(file="test.create_chunks.Rmd",chunk_label="pressure")
  > txt = c(xx$pre_chunk,xx$post_chunk)
  > writeLines(txt,"test.create_chunks.Rmd")
  > 
  > # List chunks again
  > chunklst = list_rmd_chunks(file="test.create_chunks.Rmd")
  > chunklst
    type label start end
  1    r setup     6   8
  2    r          11  13
  3 data          14  20
  4    r          21  24
  5    r  cars    32  34
  > 
  > # Render document to test
  > rmarkdown::render("test.create_chunks.Rmd")
  Error: pandoc version 1.12.3 or higher is required and was not found (see the help page ?rmarkdown::pandoc_available).
  Execution halted
Running the tests in ‘tests/test.large_data_chunk.R’ failed.
Complete output:
  > # Use a temporary directory ----------------------------
  > owd = getwd()
  > td = tempdir(check=TRUE)
  > setwd(td)
  > 
  > # Create lots of data to insert into doc ------------------
  > x = runif(3e5)
  > y = 4*x + 3 + rnorm(3e5)
  > 
  > d = data.frame(x=x,y=y)
  > rds.fn = "test.large_data_chunk.RDS"
  > saveRDS(d,rds.fn)
  > 
  > # ~3.7 MB of data
  > # Rstudio won't open a file larger than 5 MB...
  > # But render always works...
  > 
  > # Create Rmarkdown doc --------------
  > library(knitrdata)
  > library(magrittr) # For pipe operator
  > 
  > # Create new Rmarkdown document
  > rmd.fn = "test.large_data_chunk.Rmd"
  > if (file.exists(rmd.fn))
  +   file.remove(rmd.fn)
  > rmarkdown::draft(rmd.fn,"github_document","rmarkdown",edit=FALSE)
  > 
  > # Create chunks ------------------
  > 
  > loadlib = create_chunk("library(knitrdata)",chunk_type="r",chunk_label="loadlib")
  > loaddata = data_encode(
  +   rds.fn,"base64",
  +   options=list(linewidth=300)) %>% # Make lines longer to help with visualization
  +   create_chunk(output.var="d",format="binary",loader.function=readRDS,
  +                echo=TRUE, # Test max.echo option of knitrdata
  +                chunk_label="loaddata")
  > analyzedata = create_chunk("summary(lm(y~x,data=d))",chunk_type="r",chunk_label="analyzedata")
  > 
  > # Push chunks into document ------------------
  > 
  > # Insert in reverse order to not have to figure out line number
  > rmd.text = readLines(rmd.fn)
  > 
  > rmd.text = insert_chunk(analyzedata,11,rmd.text=rmd.text)
  > rmd.text = insert_chunk(loaddata,11,rmd.text=rmd.text)
  > rmd.text = insert_chunk(loadlib,11,rmd.text=rmd.text)
  > 
  > writeLines(rmd.text,rmd.fn)
  > 
  > # List all chunks in document
  > chunklst = list_rmd_chunks(file=rmd.fn)
  > chunklst
    type       label start   end
  1    r       setup     6     8
  2    r     loadlib    11    13
  3 data    loaddata    14 17153
  4    r analyzedata 17154 17156
  5    r        cars 17164 17166
  6    r    pressure 17172 17174
  > 
  > # View file in Rstudio ----------
  > # rstudioapi::navigateToFile(rmd.fn)
  > 
  > # Rstudio will warn about file size and will take some time to open it,
  > # but it does eventually work. If you collapse down the visualization
  > # of the data chunk, then moving around and editing the documents works
  > # rapidly without any problems.
  > 
  > # Render document to test -------
  > system.time(
  +   rmarkdown::render(rmd.fn)
  + )
  Error: pandoc version 1.12.3 or higher is required and was not found (see the help page ?rmarkdown::pandoc_available).
  Timing stopped at: 0.025 0.038 0.253
  Execution halted