Running ‘test.create_chunks.R’ [0s/1s]
  Running ‘test.csv_rds_chunks.R’ [0s/1s]
  Running ‘test.data_encode_decode.R’ [0s/1s]
  Running ‘test.large_data_chunk.R’ [1s/1s]
  Running ‘test.md5sum_chunks.R’ [0s/1s]
Running the tests in ‘tests/test.create_chunks.R’ failed.
Complete output:
  > # Use a temporary directory ----------------------------
  > owd = getwd()
  > td = tempdir()
  > 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)
  Error in loadNamespace(x) : there is no package called 'rmarkdown'
  Calls: loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
  Execution halted
Running the tests in ‘tests/test.csv_rds_chunks.R’ failed.
Complete output:
  > library(knitrdata)
  > library(magrittr) # For pipe operator
  > 
  > # Use a temporary directory ----------------------------
  > owd = getwd()
  > td = tempdir()
  > setwd(td)
  > 
  > # Create simple data files ------------------
  > df = data.frame(a=letters[1:3],b=1.1:3.1)
  > 
  > csv.fn = "test.csv_rds_chunks.csv"
  > csv2.fn = "test.csv_rds_chunks.csv2"
  > odd.fn = "test.csv_rds_chunks.odd"
  > rds.fn = "test.csv_rds_chunks.RDS"
  > 
  > write.csv(df,csv.fn,row.names=FALSE)
  > write.csv2(df,csv2.fn,row.names=FALSE)
  > write.table(df,odd.fn,row.names=FALSE,sep="|",dec=":")
  > saveRDS(df,rds.fn)
  > 
  > # Create chunks ------------------
  > loadlib = create_chunk("library(knitrdata)",chunk_type="r",chunk_label="loadlib")
  > 
  > lines = readLines(csv.fn)
  > lines2 = readLines(csv2.fn)
  > lines3 = readLines(odd.fn)
  > 
  > loadcsv =
  +   create_chunk(lines,output.var="df.csv",echo=TRUE,chunk_label="loadcsv",chunk_type="csv")
  > loadcsv2 =
  +   create_chunk(lines2,output.var="df.csv2",echo=TRUE,chunk_label="loadcsv2",chunk_type="csv2")
  > loadodd =
  +   create_chunk(lines3,output.var="df.odd",echo=TRUE,
  +                sep="|",dec=":",chunk_label="loadodd",chunk_type="csv")
  > 
  > loadrds = data_encode(rds.fn,"base64") %>%
  +   create_chunk(output.var="df.rds",echo=TRUE,chunk_label="loadrds",chunk_type="rds")
  > 
  > showdata = create_chunk(c("df.csv","df.csv","df.odd","df.rds"),
  +                         chunk_type="r",
  +                         chunk_label="showdata")
  > 
  > # Create Rmarkdown doc --------------
  > rmd.fn = "test.csv_rds_chunks.Rmd"
  > if (file.exists(rmd.fn))
  +   file.remove(rmd.fn)
  > rmarkdown::draft(rmd.fn,"github_document","rmarkdown",edit=FALSE)
  Error in loadNamespace(x) : there is no package called 'rmarkdown'
  Calls: loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
  Execution halted
Running the tests in ‘tests/test.large_data_chunk.R’ failed.
Complete output:
  > # Use a temporary directory ----------------------------
  > owd = getwd()
  > td = tempdir()
  > 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)
  Error in loadNamespace(x) : there is no package called 'rmarkdown'
  Calls: loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
  Execution halted
Running the tests in ‘tests/test.md5sum_chunks.R’ failed.
Complete output:
  > library(knitrdata)
  > library(magrittr) # For pipe operator
  > 
  > # Use a temporary directory ----------------------------
  > owd = getwd()
  > td = tempdir()
  > setwd(td)
  > 
  > # Create simple text files ------------------
  > 
  > # Text file with platform line separator
  > pn = platform.newline()
  > txt = paste0(pn,"Hello",pn,pn,"Goodbye",pn,pn)
  > txt.fn = "test.md5sum_chunks.txt"
  > writeChar(txt,txt.fn,useBytes=TRUE,eos=NULL)
  > txt.md5 = tools::md5sum(txt.fn)
  > 
  > # Text file with opposite line separator
  > opn = ifelse(pn=="\n","\r\n","\n")
  > txt2 = paste0(opn,"Goodbye",opn,opn,"Hello",opn,opn)
  > txt2.fn = "test2.md5sum_chunks.txt"
  > writeChar(txt2,txt2.fn,useBytes=TRUE,eos=NULL)
  > txt2.md5 = tools::md5sum(txt2.fn)
  > 
  > # Chinese text
  > ch.txt = "发动机测谎报告"
  > ch.fn = "test.md5sum_chunks.ch.txt"
  > writeLines(ch.txt,ch.fn,useBytes=TRUE)
  > ch.md5 = tools::md5sum(ch.fn)
  > print(ch.md5)
           test.md5sum_chunks.ch.txt 
  "16d6746135b4fb3026597cd8ec7e1749" 
  > # MD5 sums of Chinese text do not work on Windows, likely due to character encoding translation issues!!!
  > # This webpage seems pertinent: https://stackoverflow.com/questions/38230026/how-to-print-chinese-letters-from-r
  > 
  > # Create a simple binary file ----------------
  > d = data.frame(x=1:3,y=letters[1:3])
  > rds.fn = "test.md5sum_chunks.RDS"
  > saveRDS(d,rds.fn)
  > rds.md5 = tools::md5sum(rds.fn)
  > 
  > # Create Rmarkdown doc --------------
  > rmd.fn = "test.md5sum_chunks.Rmd"
  > if (file.exists(rmd.fn))
  +   file.remove(rmd.fn)
  > rmarkdown::draft(rmd.fn,"github_document","rmarkdown",edit=FALSE)
  Error in loadNamespace(x) : there is no package called 'rmarkdown'
  Calls: loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
  Execution halted