Displaying 20 results from an estimated 6000 matches similar to: "Sweave: conflict between setwd and \SweaveOpts{prefix.string=}"
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,
2017 Dec 20
1
utils::unzip ignores overwrite argument, effectively
It does give a warning, but then it overwrites the files, anyway.
Reproducible example below.
This is R 3.4.3, but it does not seem to be fixed in R-devel:
https://github.com/wch/r-source/blob/4a9ca3e5ac6b19d7faa7c9290374f7604bf0ef64/src/main/dounzip.c#L171-L174
FYI,
G?bor
dir.create(tmp <- tempfile())
setwd(tmp)
cat("old1\n", file = "file1")
cat("old2\n", file
2009 Oct 20
2
Problem using the source-function within R-functions
Dear R community,
You may have the solution to how to construct a function using the function
"source()" to build the function; i.e.
myfunction <- function(...){
source('file1.r')
source('file2.r')
}
After compiling and installing the "myfunction" in R, then calling the
"myfunction" gives an error because the content of 'file1.r' and
2012 May 24
6
R does not recognise columns and rows as they are supposed to be
Dear All,
The code given bellow is to extract values of one region and write that to
a text file(there are 365 binary files in the directory).
The problem which I am facing is that all my files are binary with size of
360 rows and 720 columns.
I specified that in this line: file2<-matrix(data=file,ncol=720,nrow=360)
but I got an error : Error in mean(file2[X, Y], na.rm = TRUE) : subscript
2010 Dec 23
5
Writing a single output file
Dear R helpers!
Let me first wish all of you "Merry Christmas and Very Happy New year 2011"
"Christmas day is a day of Joy and Charity,
May God make you rich in both" - Phillips Brooks
## ----------------------------------------------------------------------------------------------------------------------------
I have a process which generates number of outputs. The R code
2009 Jul 23
1
SweaveOpts(eval=false) not working - CORRECTION
On Thu, Jul 23, 2009 at 3:04 PM, Duncan Murdoch<murdoch at stats.uwo.ca> wrote:
> On 23/07/2009 8:58 AM, Rainer M Krug wrote:
>>
>> Hi
>>
>> I hope this is the right mailing list - if not, could you please refer
>> me to a mora appropriate?
>>
>> My question:
>>
>> I am using sweave (in LyX with beamer) for a lecture and I would like
2010 Nov 25
1
\Sweaveopts error
I have a file 4lmetc.Rnw, intended for inclusion in a LaTeX document,
that starts:
\SweaveOpts{engine=R, keep.source=TRUE}
\SweaveOpts{eps=FALSE, prefix.string=snArt/4lmetc}
The attempt to process the file through Sweave generates the error:
> Sweave("4lmetc")
Writing to file 4lmetc.tex
Processing code chunks ...
1 : keep.source term verbatim
Error in file(srcfile$filename, open =
2011 Apr 14
1
trouble with \SweaveOpts{grdevice=...}
Dear all
I've just tried the brand new 'grdevice' option in Sweave but couldn't
make it work. When I declare
\SweaveOpts{grdevice=pdf}
or
\SweaveOpts{grdevice=cairo_pdf}
trying to plot something simple
<<fig=T, echo=T>>=
plot(1:10,1:10,main='Some title')
@
would result in an Sweave error:
18:16:47.299: 1 : term verbatim
18:16:47.308: 2 : echo term verbatim
2010 Dec 10
1
Sweave: Setting options with SweaveOpts{} when using driver=RweaveHTML
When using Sweave in connection with the driver RweaveLatex(), global options can be set with \SweaveOpts{}, e.g.
\SweaveOpts{keep.source=T}.
Does anybody know if it is possible to set global options in the same way when using Sweave with the driver RweaveHTML().
Regards
Søren
[[alternative HTML version deleted]]
2004 Mar 30
2
Sweave and graphic output locations
Hello,
I'm using R1.8.1 on windows 2000 and version 1.8.1 of the tools package.
I am attempting to have Sweave write files to a different directory via:
testfile <- system.file("Sweave", "Sweave-test-1.Rnw",
package = "tools")
## create a LaTeX file
Sweave(
testfile,
output = "C:/temp/Sweave-test-1.tex",
2012 Jan 20
2
rbind()
Hello there,
Much thanks in advance for any help. I have a few questions:
1) Why do I keep getting the following error:
File1 <- read.csv("../RawData/File1.csv",as.is=TRUE,row.names=1)
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file '../RawData/File1.csv': No such file or
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
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
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
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 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
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/'
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
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
2008 Dec 16
2
Syncing file with reference to another one
I have the following situation: file2 on remote host and file1 on
localhost. file1 and file2 are mostly the same. Simply running
rsync remotehost:file2 file2
will actually transfer the entire file. But I would like to use the
factt that I have local file1 that is mostly similar to file2. I.e.
how can I make rsync to use file1 as a reference while transferring
file2? (cp file1 file2 locally and