Last updated on 2022-09-11 12:56:20 CEST.
Flavor | Version | Tinstall | Tcheck | Ttotal | Status | Flags |
---|---|---|---|---|---|---|
r-devel-linux-x86_64-debian-clang | 0.6.1 | 3.23 | 46.25 | 49.48 | NOTE | |
r-devel-linux-x86_64-debian-gcc | 0.6.1 | 1.93 | 36.19 | 38.12 | NOTE | |
r-devel-linux-x86_64-fedora-clang | 0.6.1 | 71.07 | NOTE | |||
r-devel-linux-x86_64-fedora-gcc | 0.6.1 | 67.73 | NOTE | |||
r-devel-windows-x86_64 | 0.6.1 | 5.00 | 86.00 | 91.00 | NOTE | |
r-patched-linux-x86_64 | 0.6.1 | 3.05 | 44.84 | 47.89 | NOTE | |
r-release-linux-x86_64 | 0.6.1 | 1.95 | 45.45 | 47.40 | NOTE | |
r-release-macos-arm64 | 0.6.1 | 27.00 | NOTE | |||
r-release-macos-x86_64 | 0.6.1 | 35.00 | NOTE | |||
r-release-windows-x86_64 | 0.6.1 | 20.00 | 82.00 | 102.00 | NOTE | |
r-oldrel-macos-arm64 | 0.6.1 | 28.00 | NOTE | |||
r-oldrel-macos-x86_64 | 0.6.1 | 39.00 | NOTE | |||
r-oldrel-windows-ix86+x86_64 | 0.6.1 | 7.00 | 69.00 | 76.00 | ERROR |
Version: 0.6.1
Check: LazyData
Result: NOTE
'LazyData' is specified without a 'data' directory
Flavors: r-devel-linux-x86_64-debian-clang, r-devel-linux-x86_64-debian-gcc, r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-devel-windows-x86_64, r-patched-linux-x86_64, r-release-linux-x86_64, r-release-macos-arm64, r-release-macos-x86_64, r-release-windows-x86_64, r-oldrel-macos-arm64, r-oldrel-macos-x86_64, r-oldrel-windows-ix86+x86_64
Version: 0.6.1
Check: dependencies in R code
Result: NOTE
Namespace in Imports field not imported from: ‘methods’
All declared Imports should be used.
Flavors: r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-release-macos-arm64, r-release-macos-x86_64, r-oldrel-macos-arm64, r-oldrel-macos-x86_64
Version: 0.6.1
Check: examples
Result: ERROR
Running examples in 'knitrdata-Ex.R' failed
The error most likely occurred in:
> ### Name: create_chunk
> ### Title: Tools for creating (data) chunks and inserting them into
> ### Rmarkdown documents
> ### Aliases: create_chunk insert_chunk
>
> ### ** Examples
>
> # 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)
>
> # List all chunks in document
> chunklst = list_rmd_chunks(file="test.create_chunks.Rmd")
> chunklst
type label start end
1 r setup 6 8
2 r cars 18 20
3 r pressure 26 28
>
> # 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 cars 18 20
>
> # Remove all but setup chunk
> remove_chunks(file="test.create_chunks.Rmd",
+ chunk_labels = 2:nrow(chunklst),
+ output.file="test.create_chunks.Rmd")
>
> # List all chunks again
> chunklst = list_rmd_chunks(file="test.create_chunks.Rmd")
> chunklst
type label start end
1 r setup 6 8
>
> # 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(chunk_label="plot",c("x","plot(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(chunk_label="thedata",output.var="x",format="binary",loader.function=readRDS) %>%
+ insert_chunk(11,txt)
> txt = create_chunk(chunk_label="loadknitrdata","library(knitrdata)",chunk_type="r") %>%
+ insert_chunk(11,txt)
>
> writeLines(txt,"test.create_chunks.Rmd")
>
> # List all chunks again
> chunklst = list_rmd_chunks(file="test.create_chunks.Rmd")
> chunklst
type label start end
1 r setup 6 8
2 r loadknitrdata 11 13
3 data thedata 14 20
4 r plot 21 24
>
> # Render document to test
> if (rmarkdown::pandoc_available(version="1.12.3"))
+ rmarkdown::render("test.create_chunks.Rmd")
processing file: test.create_chunks.Rmd
ordinary text without R code
label: setup (with options)
List of 1
$ include: logi FALSE
ordinary text without R code
label: loadknitrdata
label: thedata (with options)
List of 4
$ output.var : chr "x"
$ format : chr "binary"
$ loader.function:function (file, refhook = NULL)
$ engine : chr "data"
label: plot
ordinary text without R code
output file: test.create_chunks.knit.md
"D:/compiler/pandoc/pandoc" +RTS -K512m -RTS test.create_chunks.knit.md --to markdown_github-yaml_metadata_block --from markdown+autolink_bare_uris+tex_math_single_backslash --output test.create_chunks.md --atx-headers --template "D:\temp\RtmpsDRNqw\RLIBS_448c6beb6628\rmarkdown\rmarkdown\templates\github_document\resources\default.md"
Error in output_format$post_processor(front_matter, input, output_file, :
object 'preview_math' not found
Calls: <Anonymous> -> <Anonymous>
Execution halted
Flavor: r-oldrel-windows-ix86+x86_64
Version: 0.6.1
Check: tests
Result: ERROR
Running 'test.create_chunks.R' [1s]
Running 'test.csv_rds_chunks.R' [2s]
Running 'test.data_encode_decode.R' [1s]
Running 'test.large_data_chunk.R' [6s]
Running 'test.md5sum_chunks.R' [2s]
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)
>
> # List all chunks in document
> chunklst = list_rmd_chunks(file="test.create_chunks.Rmd")
> chunklst
type label start end
1 r setup 6 8
2 r cars 18 20
3 r pressure 26 28
>
> # 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 cars 18 20
>
> # Remove all but setup chunk
> remove_chunks(file="test.create_chunks.Rmd",
+ chunk_labels = 2:nrow(chunklst),
+ output.file="test.create_chunks.Rmd")
>
> # List all chunks again
> chunklst = list_rmd_chunks(file="test.create_chunks.Rmd")
> chunklst
type label start end
1 r setup 6 8
>
> # 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(chunk_label="plot",c("x","plot(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(chunk_label="thedata",output.var="x",format="binary",loader.function=readRDS) %>%
+ insert_chunk(11,txt)
> txt = create_chunk(chunk_label="loadknitrdata","library(knitrdata)",chunk_type="r") %>%
+ insert_chunk(11,txt)
>
> writeLines(txt,"test.create_chunks.Rmd")
>
> # List all chunks again
> chunklst = list_rmd_chunks(file="test.create_chunks.Rmd")
> chunklst
type label start end
1 r setup 6 8
2 r loadknitrdata 11 13
3 data thedata 14 20
4 r plot 21 24
>
> # Render document to test
> if (rmarkdown::pandoc_available(version="1.12.3"))
+ rmarkdown::render("test.create_chunks.Rmd")
processing file: test.create_chunks.Rmd
ordinary text without R code
label: setup (with options)
List of 1
$ include: logi FALSE
ordinary text without R code
label: loadknitrdata
label: thedata (with options)
List of 4
$ output.var : chr "x"
$ format : chr "binary"
$ loader.function:function (file, refhook = NULL)
$ engine : chr "data"
label: plot
ordinary text without R code
output file: test.create_chunks.knit.md
"D:/compiler/pandoc/pandoc" +RTS -K512m -RTS test.create_chunks.knit.md --to markdown_github-yaml_metadata_block --from markdown+autolink_bare_uris+tex_math_single_backslash --output test.create_chunks.md --atx-headers --template "D:\temp\RtmpsDRNqw\RLIBS_448c1919125a\rmarkdown\rmarkdown\templates\github_document\resources\default.md"
Error in output_format$post_processor(front_matter, input, output_file, :
object 'preview_math' not found
Calls: <Anonymous> -> <Anonymous>
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)
>
> # 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(showdata,11,rmd.text=rmd.text)
> rmd.text = insert_chunk(loadrds,11,rmd.text=rmd.text)
> rmd.text = insert_chunk(loadodd,11,rmd.text=rmd.text)
> rmd.text = insert_chunk(loadcsv2,11,rmd.text=rmd.text)
> rmd.text = insert_chunk(loadcsv,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 csv loadcsv 14 19
4 csv2 loadcsv2 20 25
5 csv loadodd 26 31
6 rds loadrds 32 37
7 r showdata 38 43
8 r cars 51 53
9 r pressure 59 61
>
> # View file in Rstudio ----------
> # rstudioapi::navigateToFile(rmd.fn)
>
> # Clean environment ------
> l = ls()
> l = l[!(l %in% c("rmd.fn","owd"))]
> rm(list=l)
>
> # Render document to test -------
> if (rmarkdown::pandoc_available(version="1.12.3"))
+ system.time(
+ rmarkdown::render(rmd.fn)
+ )
processing file: test.csv_rds_chunks.Rmd
ordinary text without R code
label: setup (with options)
List of 1
$ include: logi FALSE
ordinary text without R code
label: loadlib
label: loadcsv (with options)
List of 3
$ output.var: chr "df.csv"
$ echo : logi TRUE
$ engine : chr "csv"
label: loadcsv2 (with options)
List of 3
$ output.var: chr "df.csv2"
$ echo : logi TRUE
$ engine : chr "csv2"
label: loadodd (with options)
List of 5
$ output.var: chr "df.odd"
$ echo : logi TRUE
$ sep : chr "|"
$ dec : chr ":"
$ engine : chr "csv"
label: loadrds (with options)
List of 3
$ output.var: chr "df.rds"
$ echo : logi TRUE
$ engine : chr "rds"
label: showdata
ordinary text without R code
label: cars
ordinary text without R code
label: pressure (with options)
List of 1
$ echo: logi FALSE
ordinary text without R code
output file: test.csv_rds_chunks.knit.md
"D:/compiler/pandoc/pandoc" +RTS -K512m -RTS test.csv_rds_chunks.knit.md --to markdown_github-yaml_metadata_block --from markdown+autolink_bare_uris+tex_math_single_backslash --output test.csv_rds_chunks.md --atx-headers --template "D:\temp\RtmpsDRNqw\RLIBS_448c1919125a\rmarkdown\rmarkdown\templates\github_document\resources\default.md"
Error in output_format$post_processor(front_matter, input, output_file, :
object 'preview_math' not found
Calls: system.time -> <Anonymous> -> <Anonymous>
Timing stopped at: 0.31 0.08 0.51
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)
>
> # 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 17152
4 r analyzedata 17153 17155
5 r cars 17163 17165
6 r pressure 17171 17173
>
> # 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 -------
> if (rmarkdown::pandoc_available(version="1.12.3"))
+ system.time(
+ rmarkdown::render(rmd.fn)
+ )
processing file: test.large_data_chunk.Rmd
ordinary text without R code
label: setup (with options)
List of 1
$ include: logi FALSE
ordinary text without R code
label: loadlib
label: loaddata (with options)
List of 5
$ output.var : chr "d"
$ format : chr "binary"
$ loader.function:function (file, refhook = NULL)
$ echo : logi TRUE
$ engine : chr "data"
label: analyzedata
ordinary text without R code
label: cars
ordinary text without R code
label: pressure (with options)
List of 1
$ echo: logi FALSE
ordinary text without R code
output file: test.large_data_chunk.knit.md
"D:/compiler/pandoc/pandoc" +RTS -K512m -RTS test.large_data_chunk.knit.md --to markdown_github-yaml_metadata_block --from markdown+autolink_bare_uris+tex_math_single_backslash --output test.large_data_chunk.md --atx-headers --template "D:\temp\RtmpsDRNqw\RLIBS_448c1919125a\rmarkdown\rmarkdown\templates\github_document\resources\default.md"
Error in output_format$post_processor(front_matter, input, output_file, :
object 'preview_math' not found
Calls: system.time -> <Anonymous> -> <Anonymous>
Timing stopped at: 3.02 0.25 3.49
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 = "å<c2><8f><c2><91>å<c2><8a>¨æ<c2><9c>ºæµ<c2><8b>è°<c2><8e>æ<c2><8a>¥å<c2><91><c2><8a>"
> 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
"607d4928052edb4f05c83a86c487b8d5"
> # 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)
>
> # Create chunks ------------------
> loadlib = create_chunk("library(knitrdata)",chunk_type="r",chunk_label="loadlib")
>
> lines = readLines(txt.fn)
> lines2 = readLines(txt2.fn)
>
> co = paste0('md5sum="',txt.md5,'"')
> loadtxt =
+ create_chunk(lines,output.var="txt",output.file="output.md5sum_chunks.txt",
+ format="text",echo=TRUE,
+ chunk_label="loadtxt",chunk_options_string = co
+ )
>
> # Text chunk specifying explicitly newline character to use
> oopn = ifelse(opn=="\n","\\n","\\r\\n")
> co2 = paste0('md5sum="',txt2.md5,'",line.sep="',oopn,'"')
> loadtxt2 =
+ create_chunk(lines2,output.var="txt2",output.file="output2.md5sum_chunks.txt",
+ format="text",echo=TRUE,
+ chunk_label="loadtxt2",chunk_options_string = co2
+ )
>
> loadtxt64 = data_encode(txt.fn,"base64") %>%
+ create_chunk(output.var="txt64",output.file="output.md5sum_chunks.64.txt",
+ format="text",echo=TRUE,encoding="base64",
+ chunk_label="loadtxt64",chunk_options_string = co
+ )
>
> co2 = paste0('md5sum="',txt2.md5,'"')
> loadtxt264 = data_encode(txt2.fn,"base64") %>%
+ create_chunk(output.var="txt264",output.file="output2.md5sum_chunks.64.txt",
+ format="text",echo=TRUE,encoding="base64",
+ chunk_label="loadtxt264",chunk_options_string = co2
+ )
>
> co = paste0('md5sum="',rds.md5,'"')
> loaddata = data_encode(rds.fn,"base64") %>%
+ create_chunk(output.var="d",output.file="output.md5sum_chunks.RDS",
+ format="binary",loader.function=readRDS,echo=TRUE,
+ chunk_label="loadrds",chunk_options_string = co
+ )
>
> showdata = create_chunk(c("cat(txt)","cat(txt2)","cat(txt64)","cat(txt264)","d"),
+ chunk_type="r",
+ chunk_label="showdata")
>
> # Chinese text - md5sum test fails on Windows
> co = paste0('md5sum="',ch.md5,'"')
> loadch =
+ create_chunk(file=ch.fn,output.var="chtxt",output.file="output.md5sum_chunks.ch.txt",
+ format="text",echo=TRUE,
+ chunk_label="loadchtxt"
+ #,chunk_options_string = co # MD5 sum fails on Windows
+ )
>
> showch = create_chunk(c("cat(chtxt)","tools::md5sum('output.md5sum_chunks.ch.txt')"),
+ chunk_type="r",
+ chunk_label="showch")
>
> # 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(showch,11,rmd.text=rmd.text)
> rmd.text = insert_chunk(loadch,11,rmd.text=rmd.text)
> rmd.text = insert_chunk(showdata,11,rmd.text=rmd.text)
> rmd.text = insert_chunk(loaddata,11,rmd.text=rmd.text)
> rmd.text = insert_chunk(loadtxt264,11,rmd.text=rmd.text)
> rmd.text = insert_chunk(loadtxt64,11,rmd.text=rmd.text)
> rmd.text = insert_chunk(loadtxt2,11,rmd.text=rmd.text)
> rmd.text = insert_chunk(loadtxt,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 loadtxt 14 20
4 data loadtxt2 21 27
5 data loadtxt64 28 30
6 data loadtxt264 31 33
7 data loadrds 34 39
8 r showdata 40 46
9 data loadchtxt 47 49
10 r showch 50 53
11 r cars 61 63
12 r pressure 69 71
>
> # View file in Rstudio ----------
> # rstudioapi::navigateToFile(rmd.fn)
>
> # Clean environment ------
> l = ls()
> l = l[!(l %in% c("rmd.fn","owd"))]
> rm(list=l)
>
> # Render document to test -------
> if (rmarkdown::pandoc_available(version="1.12.3")) {
+ system.time(
+ rmarkdown::render(rmd.fn)
+ )
+
+ # Check MD5 sum of Chinese text before and after
+ print(tools::md5sum('output.md5sum_chunks.ch.txt'))
+ }
processing file: test.md5sum_chunks.Rmd
ordinary text without R code
label: setup (with options)
List of 1
$ include: logi FALSE
ordinary text without R code
label: loadlib
label: loadtxt (with options)
List of 6
$ output.var : chr "txt"
$ output.file: chr "output.md5sum_chunks.txt"
$ format : chr "text"
$ echo : logi TRUE
$ md5sum : chr "7ce2f82f5a3b96155d4c8ccbfee4d3d9"
$ engine : chr "data"
label: loadtxt2 (with options)
List of 7
$ output.var : chr "txt2"
$ output.file: chr "output2.md5sum_chunks.txt"
$ format : chr "text"
$ echo : logi TRUE
$ md5sum : chr "1f4eff16c7b0de6ec8521162c93746fc"
$ line.sep : chr "\n"
$ engine : chr "data"
label: loadtxt64 (with options)
List of 7
$ output.var : chr "txt64"
$ output.file: chr "output.md5sum_chunks.64.txt"
$ format : chr "text"
$ echo : logi TRUE
$ encoding : chr "base64"
$ md5sum : chr "7ce2f82f5a3b96155d4c8ccbfee4d3d9"
$ engine : chr "data"
label: loadtxt264 (with options)
List of 7
$ output.var : chr "txt264"
$ output.file: chr "output2.md5sum_chunks.64.txt"
$ format : chr "text"
$ echo : logi TRUE
$ encoding : chr "base64"
$ md5sum : chr "1f4eff16c7b0de6ec8521162c93746fc"
$ engine : chr "data"
label: loadrds (with options)
List of 7
$ output.var : chr "d"
$ output.file : chr "output.md5sum_chunks.RDS"
$ format : chr "binary"
$ loader.function:function (file, refhook = NULL)
$ echo : logi TRUE
$ md5sum : chr "19cb5b9d1971b1417ca19c57388fb7d0"
$ engine : chr "data"
label: showdata
label: loadchtxt (with options)
List of 5
$ output.var : chr "chtxt"
$ output.file: chr "output.md5sum_chunks.ch.txt"
$ format : chr "text"
$ echo : logi TRUE
$ engine : chr "data"
label: showch
ordinary text without R code
label: cars
ordinary text without R code
label: pressure (with options)
List of 1
$ echo: logi FALSE
ordinary text without R code
output file: test.md5sum_chunks.knit.md
"D:/compiler/pandoc/pandoc" +RTS -K512m -RTS test.md5sum_chunks.knit.md --to markdown_github-yaml_metadata_block --from markdown+autolink_bare_uris+tex_math_single_backslash --output test.md5sum_chunks.md --atx-headers --template "D:\temp\RtmpsDRNqw\RLIBS_448c1919125a\rmarkdown\rmarkdown\templates\github_document\resources\default.md"
Error in output_format$post_processor(front_matter, input, output_file, :
object 'preview_math' not found
Calls: system.time -> <Anonymous> -> <Anonymous>
Timing stopped at: 0.33 0.12 0.56
Execution halted
Flavor: r-oldrel-windows-ix86+x86_64