Displaying 3 results from an estimated 3 matches for "oldsetwd".
Did you mean:
oldset
2012 Jul 30
1
locked binding of setwd() in R 2.15.x causes .Rprofile to fail
...er R 2.15?
Error in utils::assignInNamespace("setwd", function(dir) { :
locked binding of ?setwd? cannot be changed
######################
#-- functions from .Rprofile
# modify setwd() to also show the current path in the window title
# assigns .lastdir in the global environment
local({
oldsetwd <- setwd
utils::assignInNamespace("setwd",
function(dir) {
.lastdir <<- oldsetwd(dir)
utils::setWindowTitle( short.path(base::getwd()) )
.lastdir
}, "base")
})
# setwd replacement, allowing cd() to be like 'cd -' on unix (return to
last dir)
cd <- function(...
2013 Feb 07
1
assignInNamespace to create a setwd() replacement: how to use unlockBinding()?
...for setwd(), but with the difference that
cd() acts like cd - under the tcsh shell,
returning to the previously stored directory.
#### setwd-new.R ######
# .Rprofile functions to set current directory in WindowTitle
#======================
# setwd() replacement functions
#======================
oldsetwd <- base::setwd
utils::assignInNamespace("setwd",
function(dir) {
.lastdir <<- oldsetwd(dir)
utils::setWindowTitle( short.path(base::getwd()) )
.lastdir
}, "base")
# setwd replacement, allowing cd() to be like 'cd -' on unix (return to
last dir)
cd <- functi...
2009 Oct 30
1
.Rprofile replacement function setwd() causing errors
In my .Rprofile I have the following functions which display the
current directory in the main R window title bar,
and modify base::setwd() to keep this up to date. I like this because I
can always tell where I am in the file system.
cd <- function(dir) {
base::setwd(dir)
utils::setWindowTitle( short.path(base::getwd()) )
}
short.path <- function(dir, len=2) {
np