From 0d9f1c4cd3a124088723ff30050e19f62f3d54ef Mon Sep 17 00:00:00 2001 From: Yihui Xie Date: Mon, 10 Dec 2018 16:09:37 -0600 Subject: [PATCH] grepl(..., code) may return a logical vector of length > 1, which will fail in r-devel when _R_CHECK_LENGTH_1_CONDITION_=true --- R/block.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/block.R b/R/block.R index 9c3703f2ab..5bfe813b1e 100644 --- a/R/block.R +++ b/R/block.R @@ -470,7 +470,7 @@ process_tangle.block = function(x) { paste(unlist(cmds), collapse = '\n') } else knit_code$get(label) # read external code if exists - if (!isFALSE(ev) && length(code) && grepl('read_chunk\\(.+\\)', code)) { + if (!isFALSE(ev) && length(code) && any(grepl('read_chunk\\(.+\\)', code))) { eval(parse_only(unlist(stringr::str_extract_all(code, 'read_chunk\\(([^)]+)\\)')))) } code = parse_chunk(code)