Interacting with the file system

  • I find this very useful knowledge when using notebooks (just note, in the IPython notebooks this stuff is shell commands prefixed with a "!")
  • Some basics you are most likely familiar with are as follows (not an exhaustive list!) - for a more thorough list go here

In [ ]:
getwd()

In [ ]:
R.home()

In [ ]:
R.version.string

In [ ]:
# setwd()

In [ ]:
dir()

In [ ]:
dir(pattern = "ipynb")

In [ ]:
nbs <- dir(pattern = "ipynb")
print(nbs[1])
file.info(nbs[1])$isdir
file.exists(nbs[1])

In [ ]:
p <- file.path(getwd(), 'newfile')
print(p)
basename(p)
dirname(p)

Created by a Microsoft Employee.

The MIT License (MIT)
Copyright (c) 2016 Micheleen Harris


In [ ]: