Displaying 20 results from an estimated 3000 matches similar to: "Change working directory"
2009 Nov 16
3
Error on reading an excel file
Hello everybody, here is the code I use to read an excel file containing two
rows, one of date, the other of prices:
library(RODBC)
z <- odbcConnectExcel("SPX_HistoricalData.xls")
datas <- sqlFetch(z,"Sheet1")
close(z)
It works pretty well but the only thing is that the datas stop at row 7530
and I don?t know why datas is a data frame that contains 7531 rows with the
2009 Nov 18
1
Creating an excel file and manipulating it from R
Hello everybody, I?ve been looking for a function that would create an excel
file in my working directory where I would write my dataframe but I only
found the functions to write or read in an existing file that you gave me on
my former post or on some websites. I can?t find either functions to
manipulate those datas: for example, I would like some lines to be red or
green according to their
2009 Nov 19
1
Problem with sqlSave
Hello, the sqlSave function is used in order to write a dataframe on excel.
This function creates worksheets using the attribute tablename and writes
the data.frame in it. What I want to do is to create this data.frame but
being able in case this worksheet already exists to delete the former datas
and write the new ones in it. I used the safer and append attributes. When
you set safer to false,
2009 Nov 16
5
Writing a data frame in an excel file
Hello, I am having trouble by using the write.table function to write a data
frame of 4 columns and 7530 rows. I don?t know if I should just use a
sep="\n" and change the .xls file into a .csv file. Thanks in advance
-----
Anna Lippel
new in R so be careful I should be asking a loooooooot of questions!:teeth:
--
View this message in context:
2009 Nov 13
4
Simple if else statement problem
Hello, I am getting an error with the following code:
if( P2 > P1)
+ {
+ P<-P2
+ }
> else
Erro: unexpected 'else' in "else"
> {
+ P<-P1
+ }
I checked the syntax so I don?t understand, I have other if else statements
with the same syntax working. Thanks in advance
--
View this message in context:
2009 Nov 20
2
Problem at adding lines on a graphics with lines() function
Hello, I am trying to plot a graphic with many lines with the following
command:
plot(datas[1:n,1],datas[1:n,2],type="l",main="SP500 Prices and Moving
Averages",xlab="Date",ylab="Prices",col="black")
lines(datas[1:n,1],datas[1:n,3],type="l",col="green",lty="solid")
But I just see the first curve. I have tried it on
2007 Jan 04
9
setting new working directories
Hello, and Happy New Year. My default working directory is getting very
cluttered. I know that I should be using a different working directory for
each project (I work in Windows), but do not know how to go about creating
different ones and moving back and forth between them. I have read Venables
& Ripley (Modern Applied Statistics with S-PLUS, 1994) but this seems out of
date with respect
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
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
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
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
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 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
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
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
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
2012 Apr 17
4
parallel processing with multiple directories
Hello,
I would like to run some code in parallel with each cluster reading/writing to a different working directory. I've tried the following code without success. The error I get is: "Error in setwd(x) : cannot change working directory"
library(parallel)
dirs <- list("out1","out2","out3") # these directories are located within the current
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 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
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/'