knitr::opts_knit$set(root.dir="..", cache=FALSE)
getwd()
list.files()
list.files("..")
list.files("../data")

How did you specify it? Backslashes have to be doubled in R character strings, so for example one needs ‘"d:\R-3.2.2\library\xgobi\scripts\xgobi.bat"’. You can make life easier for yourself by using forward slashes as path separators: they do work under Windows. You should include the file extension (e.g. ‘"xgobi.bat"’ rather than just ‘"xgobi"’); sometimes this isn’t shown in Windows Explorer, but it is necessary in R.

A simple way to avoid these problems is to use the function file.choose() to invoke the standard Windows file selection dialog. If you select a file there, the name will be passed to R in the correct format.

http://yihui.name/knitr/options/

Do not confuse the working directory of your current R console with the working directory of your R Markdown document (which is the directory of this R Markdown document). When in doubt, print out getwd() where you want to know your working directory (e.g. in *.Rmd). Note R Markdown documents are compiled in separate R sessions to enhance reproducibility, so you current R console has nothing to do with the compilation of the R Markdown documents.



ZellW/LearnPlotting documentation built on May 10, 2019, 1:57 a.m.