search for: getwd

Displaying 20 results from an estimated 926 matches for "getwd".

Did you mean: getcwd
2009 Jun 23
3
list.files(getwd()) and list.files(getwd(), full.names=TRUE) appear to return directory names
Is there any way to make list.files(getwd()) or list.files(getwd(),full.names=TRUE) stop returning directories? Right now both appear to return both file names and folders within the location. I would like for it only to return file names and not folders. I am using this on Windows with R version 2.9.0 (2009-04-17). Thank you agai...
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 RStudio 0.96.228 and R 2.15.2. Regards Markus
2010 Aug 12
5
Where the data file is stored?
Hi folks, OS - Ubuntu 10.04 On R I create a datafile named "data". I can evoke it on R with; > data On R Commander Data -> Active data set -> Select active data set -> (data) OK only one data set there "data" -> View data set I can read it -> Edit data set showing 25 rows of data. Clicking the box shows a thick border around it. But I couldn't
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 = dirname(source_pathname ) setwd(source_dirname) print(getwd()) Question: Is there a better, cleaner way? Thanks, mrgomel [[alternative HTML version deleted]]
2008 Apr 24
4
bug in file.path?
Se ha borrado un texto insertado con un juego de caracteres sin especificar... Nombre: no disponible Url: https://stat.ethz.ch/pipermail/r-help/attachments/20080424/2226f24e/attachment.pl
2000 Mar 07
0
getwd/setwd function
Hello All, It appears that something is still not right with my linux systems. I can compile R (ie make and make install) but make check fails. It appears that the getwd and setwd functions don't work -- getwd returns gibberish. Thus I can run the graphics demo until it tries to read in the iris data. I'll admit I've done maybe too much to these systems to be able to get R to compile again, but some hints as to where the problem might be would be he...
2017 Jul 14
3
setwd in windows
...o 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 to setwd - to define the HOME - and redefine it. As I read 2.14 R_USER is used for HOME when set. To no avail. Best wishes Troels getwd() #[1] "C:/firstdir" Sys.getenv("R_USER") #"C:\\Users\\Bruger\\Documents" dir() #[1] "chdir.R" "secdir" setwd("~/secdir") error in setwd("~/secdir") : cannot change working directory setwd("C:/firstdir/secdir") getwd(...
2001 Sep 14
2
tkfilefind in tcltk on Windows2000
Hi, The tkfilefind demo in the tcltk package doesn't seem to work for me in Windows2000. The demo script uses tkfilefind(".") which doesn't display the parent directory so you can't browse around the whole drive. Using tkfilefind() (which uses the default path getwd()) doesn't seem to work for me at all. I also tried tkfilefind("/") which worked fine but then using > a<-tkfilefind("/") > a [1] "//jm2.null.mc.img" > library(AnalyzeFMRI) > f.analyze.file.summary(a) causes R to crash i.e. using "//jm2.null....
2009 Oct 30
1
.Rprofile replacement function setwd() causing errors
...he 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 <-length(parts <- unlist(strsplit(dir, '/'))) parts <-rev( rev(parts)[1:min(np,len)] ) dots <- ifelse (np>len, '...', '') paste(dots,paste(parts, '/', sep='', collapse=''...
2009 Sep 23
1
set choose.files directory?
Hi, I've been trying to set the directory for choose.files as follows: [R2.9.0 running on XP] setwd("C:/Documents and Settings/2/Data") getwd() infile2 = choose.files(filters = Filters[c("txt","All"),], caption = "Choose ECD datafile") #<...do a bunch of stuff...> It appears the working directory isn't updated until after choose.files() executes. getwd() returns the correct path, as set by setw...
2005 Dec 02
0
R CMD INSTALL fails if cd prints stuff to stdout ... (PR#8363)
...g '/home/philip/tmp/GlobalAncova /var/tmp/philip/misc/GlobalAncova' (i.e. including the new line. Incidentally, /home/philip/tmp dir is a symlink to /var/tmp/philip/misc; hence the non-identical directory names). A simple fix (cd "${1}" > /dev/null 2>&1 && ${GETWD}) takes care of this, and should work under sh, ksh, bourne shell, zsh. A context diff is attached; I hope this will prove useful. Kind regards, Philip -- Philip Lijnzaad Genomics Laboratory Dept. of Biomedical Genetics Un...
2017 Aug 05
3
Error in setwd("dir") :
...I have gone through forums but nothing seemed relevant to my issue. What bugs me the most is the ("dir") that the error shows, is of those who wrote the source code and not mine(it still sees the directory of their computer, even though, I have changed all the directories). When I write getwd(), it dispalys my "dir". Does anyone have any ideas on what's going on here? Thank you -- Greg Lyukshin [[alternative HTML version deleted]] [[alternative HTML version deleted]]
2012 Jul 04
4
how to get list of files within a particular local file folder
Dear List, Say I can use getwd() and setwd() to change my working directory. How can I read in all the files within that directory using command line (like a ls() but for the path specified) Regards Ajay Websites- Technology http://decisionstats.com On Wed, Jul 4, 2012 at 3:30 PM, <r-help-request@r-project.org> wrot...
2005 Dec 02
0
(PR#8363) R CMD INSTALL fails if cd prints stuff to stdout
...lobalAncova > /var/tmp/philip/misc/GlobalAncova' > > (i.e. including the new line. Incidentally, /home/philip/tmp dir is a symlink > to /var/tmp/philip/misc; hence the non-identical directory names). > > A simple fix (cd "${1}" > /dev/null 2>&1 && ${GETWD}) takes care of this, and > should work under sh, ksh, bourne shell, zsh. A context diff is attached; I > hope this will prove useful. Kind regards, > > > Philip > > -- > Philip Lijnzaad > Genomics Lab...
2012 Jul 30
1
locked binding of setwd() in R 2.15.x causes .Rprofile to fail
...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(dir) { if(missing(dir)) dir <- .lastdir .lastdir <<- base::setwd(dir) utils::setWindowTitle( short.path(base::getwd()) ) } short.path <- f...
2009 Oct 29
1
strsplit() and Windows file paths
There are two ways to express file paths with the Windows environment: > a=file.choose() > a [1] "C:\\Documents and Settings\\rbaer\\Desktop\\_VNT_Test\\coordFocused 20k F5 0ng Ki8751 t20.txt" and >b= paste(getwd(),"/",dir()[1],sep="") >b [1] "C:/Documents and Settings/rbaer/Desktop/_VNT_Test/coordFocused 20k F5 0ng Ki8751 t20.txt" I have 2 questions: 1. Is it possible to get file.choose() to use the forward slash rather than the escaped back slash. It would be nice if i...
2010 Jun 30
1
evaluate a string variable
Hello, I was wondering how to evaluate a string variable in R. eg. > avar <- "getwd()" > eval(avar) gives: [1] "getwd()" but I would like to see: [1] "/home/myhomedir" Thanks, Jeremiah
2005 Sep 01
1
R CMD BATCH on scripts without trailing newline
If the last line of an R script does not have a trailing newline, a small errror is produced at the end of the script. Small example. If file eg.r contains one line: getwd() and there is no newline after the closing paren $ R CMD BATCH eg.r produces an error: $ cat eg.r.Rout R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 Patched (2005-09-01), ISBN 3-900051-07-0 ... > getwd()proc.time() Error: syntax error Execution halted $ Is...
2013 Feb 28
1
using a personal template for new R scripts
...on(filename=tempfile(tmpdir='.',fileext='.R'), open=TRUE) { template = paste(Sys.getenv('R_USER'), 'R_template.R', sep='/') lines = readLines(template) lines = sub('Sys.time', format(Sys.time(), '%A, %d %B %Y'), lines) lines = sub('getwd', getwd(), lines) lines = sub('R.version.string', R.version.string, lines) writeLines(lines, filename) if (open) shell.exec(filename) filename } Rather than the default of an empty file, it would be good practice to start with a structured template script. Such a template migh...
2011 Mar 21
3
appending collums in for loop
...setwd("J:/Stage/Datasets2/Datasets/outData") masterTable<-read.table("AR1000900A_N_241110_(Mapping250K_Nsp)_2,Mapping250K_Nsp,CNprobes.tab _SNP_IDs.xls",sep="\t", dec=",", fill=T, header=T) masterTable<-data.frame(masterTable) fileNames<-list.files(getwd(), pattern='_0,5 -0,51.xls') regionMatchABCDE<-data.frame() for(i in 1:5) { fileName <- fileNames[i] newFile <- file.path(getwd(), paste(fileNames[i], "samen_0,5 -0,51.xls")) snpidFile<-read.table(fileNames[i],sep="\t", dec=",", fill=T,...