In response to this question…
# first code block
knitr::opts_knit$set(root.dir = "..")
readLines("test.txt")
## Warning in file(con, "r"): cannot open file 'test.txt': No such file or
## directory
## Error in file(con, "r"): cannot open the connection
# next code block
readLines("test.txt")
## [1] "hello" "world"