Displaying 20 results from an estimated 10000 matches similar to: "setwd() permenent"
2012 Nov 02
3
Strange behaviour of setwd/getwd
I've found the following strange behaviour R (RStudio) which has been
confirmed by another user in RGui.
Inside a script I want to set two variables:
default.wd = getwd()
tmp.wd = setwd(choose.dir())
After choosing tmp.wd the value of default.wd is shown in Workspace, but
getwd() is giving back the correct string of tmp.wd.
Is there a workaround for the problem?
I'm working on
2013 Feb 20
4
Error in setwd(outDir) : cannot change working directory
I installed R on my Windows laptop in C:\Program Files\R\R-2.15.2
and am able to open RGUI (640bit), see packages and run commands. However,
when I test the installation and run the basic tests and all the tests on
the standard and recommended packages i.e.:
library("tools")
testInstalledBasic("both")
testInstalledPackages("base", errorsAreFatal
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 Sep 07
1
Problem with starting and using R
Dear all,
I encountered a problem on starting and using the R v 2.7.2 installation on
my PC running Windows Vista and would appreciate your help.
When R was first started, the Rgui returned several error messages:
Error in structure(.Internal(Sys.getenv(as.character(x),
as.character(unset)$ unsupported conversion
Error in file.exists(name) : unsupported conversion in
2005 May 16
2
a problem sourcing a file using chdir=TRUE
Dear R-users,
I used to give commands such as:
> source(file="~/path/to/file.R", chdir=TRUE)
but with the latest v. 2.1.0 it does not seem to work anymore.
I tried to figure out what it was going on and it seems that the string
for which
> class(file)
[1] "character"
is changed to
> class(file)
[1] "file" "connection"
when the connection is
2010 Jun 11
4
setting the current working directory to the location of the source file
AFAIK a script run through source() does not have any legit way to learn
about it's own location.
I need this to make sure that the script will find its datafiles after I
move the whole directory. (The datafiles are in the same directory.)
Here is a hack I invented to work around it:
print(getwd())
source_pathname = get("ofile",envir = parent.frame())
source_dirname =
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
2005 Jun 15
1
source() chdir does not work (PR#7940)
Full_Name: Alex Galakhov
Version: 2.1.0
OS: Linux (Debian)
Submission from: (NULL) (195.19.131.68)
After software upgrade source() does not work properly anymore. It completely
ignores the chdir= parameter. This is because is.character(file) is always false
after the assignment file<-file(file).
The fix is (written by hand in diff-like syntax, hopefully, you'll understand
it):
2005 Jul 19
1
Minor "bug" in source()
For R v2.1.1 patched and R v2.2.0 devel:
Calling source(file, chdir=TRUE) with is.character(file) != TRUE, that
is, with 'file' as a connection, will generate an error. Example:
> file <- textConnection("cat('Hello world\n')")
> source(file, chdir=TRUE)
Error in source(file, chdir = TRUE) : Object "ofile" not found
Of course, it does not make
2017 Jun 17
3
write.dna command
Hi all,
I am learning R by "doing". And this is my first post.
I want to use R: 1- to fetch a DNA sequence from a databank (see bellow)
and 2- store it as FASTA file.
The problem: neither an error is prompted nor the fasta file is created.
Testing the code (see bellow), I notice that everything works until
the *"write.dna"
*command - which is not creating the fasta file.
2018 May 20
3
Loop Function to Create Multiple Scatterplots
Hello,
I am trying to create multiple scatter plot graphs. I have 1 independent
variable (Age - weeks post conception) and 18 dependent variables ("Gene n"
Expression) in one csv file. Is there a way to set up a looped function to
produce 18 individual scatterplots? At the moment, I am writing the plot()
function out 18 times to make the 18 graphs. My code is below and csv file
is
2013 Jun 12
2
Functions within functions - environments
Dear list,
I have a problem with nested functions and I don't manage to get it
solved. I know I should be looking in environments, and I have tried a
lot, but it keeps on erroring.
An easy version of the problem is as follows:
innerfunction<-function()
{
print(paste(a, " from inner function"))
print(paste(b, " from inner function"))
setwd(wd)
}
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/'
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
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
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 Aug 14
3
set working directory to current source directory
Hi all,
Is there a way to get cran R to set the working directory to be wherever
the source file is? Each time I work on a project on different computers I
keep having to set the working directory which is getting quite annoying.
Thanks,
Sachin
[[alternative HTML version deleted]]