Displaying 20 results from an estimated 7000 matches similar to: "Can't there be a cd command?"
2013 Feb 07
1
assignInNamespace to create a setwd() replacement: how to use unlockBinding()?
In my .Rprofile for Windows, I had the following functions defined to
mirror a few features
I miss from linux:
(a) replace setwd() with a version that stashes the current directory so
it can be easily restored
(b) writes a short version of the current R directory to the Windows
title bar: I can always see where I am,
with multiple Rgui windows.
(c) creates a cd() shorthand for setwd(), but
2012 Jul 30
1
locked binding of setwd() in R 2.15.x causes .Rprofile to fail
[Env: Win XP, R 2.14.2, R 2.15.0]
I have a replacement function for setwd() in my .Rprofile which displays
the current R path in the R window
title. It no longer works in R 2.15.x, giving the error below. Worse,
the error prevents the rest of my
.Rprofile script from completing.
Is there some way to rescue this, i.e., preserve this behavior in
R 2.15? If not, how can I modify my script so it
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
2017 Jul 14
3
setwd in windows
Dear friends - windows R 3.3.3 - sorry to ask a simple question - but I
cannot make setwd work properly in scripts
In the example below I have made a directory in C (firstdir) and a
directory in that (secdir) and the intention is to change directory to
the second from the first - it works when I put the entire path but not
the tilde - what am I missing? I was around rwf 2.14 as per the help
2009 Jan 20
2
Sweave: conflict between setwd and \SweaveOpts{prefix.string=}
Hello
I think there is a conflict between setwd() and
\SweaveOpts{prefix.string=}. In the same document, those both command
get Sweave confuse the files and directories. See:
say my .Rnw document is in File1
If one inserts some setwd() for another file:
-setwd(File2)
then the command \SweaveOpts{prefix.string=graphics/Rplots} will search
the "graphics" folder in File2 because of
2008 Dec 04
1
setwd and list.files / linux
Hey,
two questions regarding setwd and list.files:
I try to use the function list.files:
>datapath<-'/nfs/home/m/cremer/gaw/data/traws_chrs'
>fl<-list.files(datapath, pattern="\\.tped")
but I get the following error message:
Warning message:
In list.files(datapath, pattern = "\\.tped") :
list.files: '/nfs/home/m/cremer/gaw/data/traws_chrs/'
2012 Sep 27
1
Is there a way to source from a specific Git repository without hardcoding the location everywhere?
Folks,
A small group of us are working together to develop a set of R functions
to support data management and analysis using Eclipse/StatET in a Windows
environment. We are using Git/EGit for version control. We work within
our own repository and occasionally push to a common remote location.
I'd like to have the code source files from the 'local' git repository
without
2004 Jun 21
2
setwd problems
Hello,
I am using R for Windows and I receive error messages when trying to
change my working directory:
> setwd('C:\BACC_R')
Error in setwd(dir) : cannot change working directory
I would really appreciate your help,
Joan Serra
2012 Nov 05
2
Problem compiling Rnw file
Dear R list,
I'm using R 2.15.2 with TeX Live 2009 and ESS 12.09 . I have a R
project in the '/home/r/Documents/myproj/', which is my working
directory (where I have the .Rnw file). Inside the document I have
several "setwd()" to collect the datasets I use.
After I compile from the terminal using "R CMD Sweave myproj.Rnw", I
receive the error:
Error in
2012 Feb 26
2
Help needed! Error in setwd(newdir) : cannot change working directory
Hi Guys,
I am new to R and just trying to write a small script to automate a couple commands. But I run into the setwd(): cannot change working directory.
I googled a little bit and tried all fixes/suggestions with no success.
Basically I have a script that works from inside a directory with my data (/home/sean/Rtest/Data01). Now I want to modify the script to make it run from the upper directory
2005 Dec 14
2
Problem with dir.create (R2.2.0 Windows XP 2002 SP 2)
I've run into a problem with dir.create on R2.2.0 Windows XP 2002 SP 2.
setwd("d:/")
print(dir.create("d:\\otis-sim\\rdata", recursive=T))
print(dir.create("d:\\otis-sim\\", recursive=T))
Both return false and fail to create the directories.
setwd("c:/")
print(dir.create("d:\\otis-sim\\rdata", recursive=T))
Returns true and succesfully
2008 Jan 06
3
run setwd at the launch of R
Dear all,
my R files (and the .csv files as well) are saved somewhere pretty
deep down my hard disk.
i have to chage to working directory therefore everytime i run R (i
run it on powerPC mac), which is disgusting.
using the setwd command at the beginning of an R script doesnt really
help because i have to find this file first by hand.
I am looking for possibility to run setwd during the
2012 Mar 21
3
"cannot change working directory"
Hi,
I need to write program to run some results from an experiment. i have the
results saved in 2 different files, named "tuesday" and "wednesday" (both
located within the same file). when i wrote the program for "tuesday" i had
no problem running it, but when i changed the work directory to wednesday i
got the "cannot change working directory" message. I
2013 Jan 11
1
Patch for setwd() to show path in error message
Below is a patch for setwd() to show path in error message. Current
it just gives error messages such as:
Error in setwd(libdir) : cannot change working directory
with the patch it should (read untested) give:
Error in setwd(libdir) : cannot change working directory to 'path/that/fails/'
PATCH:
% diff -u util.c "util,patch.c"
--- util.c 2012-12-16 13:13:05.002249900
2008 Apr 18
3
Permanent change to the working directory
Dear helpers,
I've looked in the help files (maybe not very thoroughly but I looked) and I
couldn't find a straightforward way to permanently set the working directory
(where I save and read files). Each time I startup R the working dir is
automatically "C:/R/bin" [using:getwd()], and I know I can change it using
setwd [for example setwd("C:/R/DATA"), but it's only
2014 Aug 21
2
pregunta
Buenas noches Javier y José,
Estoy en contra de usar attach(), asi que propongo la siguiente alternativa
con with():
# paquete
require(epicalc)
# los argumentos en ... pasan de epicalc:::cc
# ver ?cc para mas informacion
foo <- function(var1, var2, var3, ...){
or1 <- cc(var1, var2, ...)
or2 <- cc(var1, var3, ...)
list(or1 = or1, or2 = or2)
}
# datos
x <-
2018 Apr 13
0
repeating functions for different folders?
Hi Marna,
Assuming that you are descending into different subdirectories from
the same directory:
directories<-c("dir1","dir2","dir3")
for(directory in directories) {
setwd(directory)
# do whatever you want to do
# then return to the directory above
setwd("..")
}
This will allow you to start and finish in the same directory.
Jim
On Fri, Apr 13,
2011 Aug 12
3
gsub("\\", "\\\\", "C:\Program Files\R")
Hi,
I think it is not possible in R but I rather ask before giving up:
What I have: I have copied "C:\Program Files\R" into my clipboard.
What I want: setwd(transform("C:\Program Files\R")) where the function
transform should change the "C:\Program Files\R" from my clipboard to
"C:\\Program Files\\R" so that R can handle it. Is this possible?
I've
2003 Mar 17
3
Error in file(file, "r")
Hello,
I am a new user of R, and I am not able to read/scan external files. I am
working in a Linux environment. I have read through the R FAQ and documents
and have not been successful using the recommendations. Below are several
scripts I've used and the error messages. .
I've cc'd Brandon Whitcher because it was recommended in another FAQ. I
read that this is a bug that
2007 Jul 16
2
Source inside source
Is there a way to know where is the source, so as to make a source call
inside another source smarter?
As an example:
file1.R is in directory /files/dir1/
file2.R is in directory /files/dir1/dir2/
In file1.R, there is this line:
source("dir2/file2.R")
So, if I setwd to /files/dir1/, and then I call source("file1.R"),
it will run correctly. However, if I setwd to /files,