Hi folks, OS - Ubuntu 10.04 On R I create a datafile named "data". I can evoke it on R with;> dataOn 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 edit the data inside the box. I wonder where this datafile is stored on the OS On Ubuntu terminal; $ locate data.rda $ locate data.image $ locate data.images $ locate data.csv all without printout. TIA B.R. Stephen L
By default everything in an R workspace (data objects, functions etc) will be stored in a file called .RData in the working directory. Please see http://cran.r-project.org/doc/contrib/Paradis-rdebuts_en.pdf Michael
> 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 edit the data inside the box. > > I wonder where this datafile is stored on the OS > > On Ubuntu terminal; > $ locate data.rda > $ locate data.image > $ locate data.images > $ locate data.csvYou dont't tell us what you did to "create a datafile" - to me it sounds like you created an object (probably a data frame) in your R workspace. If that's the case it is stored in a file called .RData in your current work directory (together with other variables in your workspace). If that is not what you did please give us mre information. BTW: R has a function called data and it is not a very good idea to use function names as variable names. cu Philipp -- Dr. Philipp Pagel Lehrstuhl f?r Genomorientierte Bioinformatik Technische Universit?t M?nchen Wissenschaftszentrum Weihenstephan Maximus-von-Imhof-Forum 3 85354 Freising, Germany http://webclu.bio.wzw.tum.de/~pagel/
----- Original Message ---- From: Michael Bedward <michael.bedward at gmail.com> To: Stephen Liu <satimis at yahoo.com> Cc: r-help at r-project.org Sent: Thu, August 12, 2010 3:50:12 PM Subject: Re: [R] Where the data file is stored?> By default everything in an R workspace (data objects, functions etc) > will be stored in a file called .RData in the working directory.> Please see http://cran.r-project.org/doc/contrib/Paradis-rdebuts_en.pdfHi Michael, Ah I see. Thanks $ locate RData /home/userA/.RData /usr/lib/R/site-library/qtl/data/badorder.RData /usr/lib/R/site-library/qtl/data/bristle3.RData /usr/lib/R/site-library/qtl/data/bristleX.RData /usr/lib/R/site-library/qtl/data/fake.4way.RData /usr/lib/R/site-library/qtl/data/fake.bc.RData /usr/lib/R/site-library/qtl/data/fake.f2.RData /usr/lib/R/site-library/qtl/data/hyper.RData /usr/lib/R/site-library/qtl/data/listeria.RData /usr/lib/R/site-library/qtl/data/map10.RData I left out following step;> write.csv(data, "petdrug.csv") > q()without saving. $ locate petdrug.csv /home/userA/petdrug.csv petdrug.csv can be read on OpenOffice Calc and edited there. B.R. Stephen L
Hi Barry, Following 2 commands are useful to me;> row.names(subset(file.info(list.files(getwd(),full.name=TRUE)),isdir))showing directories.> row.names(subset(file.info(list.files(getwd(),full.name=TRUE)),!isdir))showing files What is "!" for? TIA B.R. Stephen L ----- Original Message ---- From: Barry Rowlingson <b.rowlingson at lancaster.ac.uk> To: Stephen Liu <satimis at yahoo.com> Cc: r-help at r-project.org Sent: Thu, August 12, 2010 8:05:10 PM Subject: Re: [R] Where the data file is stored? On Thu, Aug 12, 2010 at 12:37 PM, Stephen Liu <satimis at yahoo.com> wrote:> ----- Original Message ---- > > From: Alain Guillet <alain.guillet at uclouvain.be> > To: Stephen Liu <satimis at yahoo.com> > Cc: r-help at r-project.org > Sent: Thu, August 12, 2010 5:28:32 PM > Subject: Re: [R] Where the data file is stored? > >> You can find your current working directory with the getwd() function. > > > Hi Alain, > > > Thanks for your advice. > > >> getwd() > [1] "/home/userA" > > >> list.files(getwd()) > [1] "Desktop" "Documents" "Downloads" > [4] "examples.desktop" "last-packages.txt" "Music" > [7] "myR" "petdrug.csv" "Pictures" > [10] "Public" "R" "Templates" > [13] "Videos" > > >> list.files(getwd(),full.name=TRUE) > [1] "/home/userA/Desktop" > [2] "/home/userA/Documents" > [3] "/home/userA/Downloads" > [4] "/home/userA/examples.desktop" > [5] "/home/userA/last-packages.txt" > [6] "/home/userA/Music" > [7] "/home/userA/myR" > [8] "/home/userA/petdrug.csv" > [9] "/home/userA/Pictures" > [10] "/home/userA/Public" > [11] "/home/userA/R" > [12] "/home/userA/Templates" > [13] "/home/userA/Videos" > > > How to show on the printout which is directory? TIAUse file.info and check the $isdir part of the returned data frame. For example, to get names of only directories in your working dir, do: row.names(subset(file.info(list.files(getwd(),full.name=TRUE)),isdir)) a quick modification gets you not-directories (which will be plain files plus special files): row.names(subset(file.info(list.files(getwd(),full.name=TRUE)),!isdir)) see ?file.info and ?files Barry
On Aug 12, 2010, at 11:51 AM, Stephen Liu wrote:> Hi Barry, > > > Following 2 commands are useful to me; >> row >> .names(subset(file.info(list.files(getwd(),full.name=TRUE)),isdir)) > showing directories. > >> row.names(subset(file.info(list.files(getwd(),full.name=TRUE)),! >> isdir)) > showing files > > > What is "!" for? TIA?"!" (learn to use R help facilities!)> > > B.R. > Stephen L > > > > > ----- Original Message ---- > From: Barry Rowlingson <b.rowlingson at lancaster.ac.uk> > To: Stephen Liu <satimis at yahoo.com> > Cc: r-help at r-project.org > Sent: Thu, August 12, 2010 8:05:10 PM > Subject: Re: [R] Where the data file is stored? > > On Thu, Aug 12, 2010 at 12:37 PM, Stephen Liu <satimis at yahoo.com> > wrote: >> ----- Original Message ---- >> >> From: Alain Guillet <alain.guillet at uclouvain.be> >> To: Stephen Liu <satimis at yahoo.com> >> Cc: r-help at r-project.org >> Sent: Thu, August 12, 2010 5:28:32 PM >> Subject: Re: [R] Where the data file is stored? >> >>> You can find your current working directory with the getwd() >>> function. >> >> >> Hi Alain, >> >> >> Thanks for your advice. >> >> >>> getwd() >> [1] "/home/userA" >> >> >>> list.files(getwd()) >> [1] "Desktop" "Documents" "Downloads" >> [4] "examples.desktop" "last-packages.txt" "Music" >> [7] "myR" "petdrug.csv" "Pictures" >> [10] "Public" "R" "Templates" >> [13] "Videos" >> >> >>> list.files(getwd(),full.name=TRUE) >> [1] "/home/userA/Desktop" >> [2] "/home/userA/Documents" >> [3] "/home/userA/Downloads" >> [4] "/home/userA/examples.desktop" >> [5] "/home/userA/last-packages.txt" >> [6] "/home/userA/Music" >> [7] "/home/userA/myR" >> [8] "/home/userA/petdrug.csv" >> [9] "/home/userA/Pictures" >> [10] "/home/userA/Public" >> [11] "/home/userA/R" >> [12] "/home/userA/Templates" >> [13] "/home/userA/Videos" >> >> >> How to show on the printout which is directory? TIA > > Use file.info and check the $isdir part of the returned data frame. > For example, to get names of only directories in your working dir, do: > > row.names(subset(file.info(list.files(getwd(),full.name=TRUE)),isdir)) > > a quick modification gets you not-directories (which will be plain > files plus special files): > > row.names(subset(file.info(list.files(getwd(),full.name=TRUE)),! > isdir)) > > see ?file.info and ?files > > Barry > > > > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.David Winsemius, MD West Hartford, CT