Re: [R] Bug in package.skeleton, R 2.9.0?
Daniel Klevebring wrote: > Bump > > Anyone? > > Thanks > Daniel > > On 13 jul 2009, at 10.57, Daniel Klevebring wrote: > >> Dear all, >> >> I am using package.skeleton to build a small packages of misc function >> for personal use. I have recently discovered that the option >> force=TRUE doesn't seem to do what is meant to do. Here's what I'm >> doing: >> >>> setwd("/Users/danielk/Documents/R/packages/dk") >>> files <- paste("codebase", dir("codebase", pattern=".R"), sep="/") >>> package.skeleton(name="dk", force=TRUE, code_files=files) >> Creating directories ... >> Creating DESCRIPTION ... >> Creating Read-and-delete-me ... >> Copying code files ... >> Making help files ... >> Done. >> Further steps are described in './dk/Read-and-delete-me'. >> Now, everything seems fine, but changes to files in me codebase >> folder, doesn't come along if the folder dk/R already contains the >> files, even though I use force=TRUE. If I remove the dk/R folder or >> the dk folder altogether, the changes come along so to me it seems >> that it's the overwrite part that doesn't work as it should - or am I >> doing something wrong here? To me, it seems that the function >> safe.dir.create (which is defined in package.skeleton never overwrites >> folders, yielding force=TRUE useless. from the help on package.skeleton force: If 'FALSE' will not overwrite an existing directory. which could be clearer in that package.skeleton will stop with an error if the top level directory, i.e. 'dk' in your case, exists and you had specified force=FALSE. But it will not overwrite the existing directory 'dk' with force=TRUE as you observed. Looking at the code it is clear that file.copy is used to copy the code files and that has per default overwrite=FALSE so your existing code files will not be overwritten. With the current implementation package.skeleton will not do what you intended. There are many ways to workaround e.g. fn <- dir("codebase", pattern=".R", full.names=TRUE) file.remove( list.files(path=file.path("dk", "R"), pattern="\\.R", full.names=TRUE)) package.skeleton(name="dk", force=TRUE, code_files=fn) Matthias >> >> See below for sessionInfo. >> >> Thanks a bunch >> Daniel >> >> >> >>> sessionInfo() >> R version 2.9.0 (2009-04-17) >> i386-apple-darwin8.11.1 >> >> locale: >> en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8 >> >> attached base packages: >> [1] stats graphics grDevices utils datasets methods base >> >> loaded via a namespace (and not attached): >> [1] tools_2.9.0 >> >> -- >> >> Contact information: >> >> Daniel Klevebring >> M. Sc. Eng., Ph.D. Student >> Dept of Gene Technology >> Royal Institute of Technology, KTH >> SE-106 91 Stockholm, Sweden >> >> Visiting address: Roslagstullsbacken 21, B3 >> Delivery address: Roslagsvägen 30B, 104 06, Stockholm >> Invoice address: KTH Fakturaserice, Ref DAKL KTHBIO, Box 24075, >> SE-10450 Stockholm >> E-mail: dan...@biotech.kth.se >> Phone: +46 8 5537 8337 (Office) >> Phone: +46 704 71 65 91 (Mobile) >> Web: http://www.biotech.kth.se/genetech/index.html >> Fax: +46 8 5537 8481 >> >> -- >> >> Contact information: >> >> Daniel Klevebring >> M. Sc. Eng., Ph.D. Student >> Dept of Gene Technology >> Royal Institute of Technology, KTH >> SE-106 91 Stockholm, Sweden >> >> Visiting address: Roslagstullsbacken 21, B3 >> Delivery address: Roslagsvägen 30B, 104 06, Stockholm >> Invoice address: KTH Fakturaserice, Ref DAKL KTHBIO, Box 24075, >> SE-10450 Stockholm >> E-mail: dan...@biotech.kth.se >> Phone: +46 8 5537 8337 (Office) >> Phone: +46 704 71 65 91 (Mobile) >> Web: http://www.biotech.kth.se/genetech/index.html >> Fax: +46 8 5537 8481 >> MSN messenger: klevebr...@msn.com >> >> >> [[alternative HTML version deleted]] >> >> > > -- > > Contact information: > > Daniel Klevebring > M. Sc. Eng., Ph.D. Student > Dept of Gene Technology > Royal Institute of Technology, KTH > SE-106 91 Stockholm, Sweden > > Visiting address: Roslagstullsbacken 21, B3 > Delivery address: Roslagsvägen 30B, 104 06, Stockholm > Invoice address: KTH Fakturaserice, Ref DAKL KTHBIO, Box 24075, > SE-10450 Stockholm > E-mail: dan...@biotech.kth.se > Phone: +46 8 5537 8337 (Office) > Phone: +46 704 71 65 91 (Mobile) > Web: http://www.biotech.kth.se/genetech/index.html > Fax: +46 8 5537 8481 > MSN messenger: klevebr...@msn.com > > > [[alternative HTML version deleted]] > > > > > > __ > R-help@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. -- Matthias Burger Project Manager/ Biostatistician Epigenomics AGKleine Praesidentenstr. 110178 Berlin, Germany phone:+49-30-24345-0fax:+49-30-24345-555 http://www.epigenomics.com
Re: [R] Bug in package.skeleton, R 2.9.0?
Bump Anyone? Thanks Daniel On 13 jul 2009, at 10.57, Daniel Klevebring wrote: > Dear all, > > I am using package.skeleton to build a small packages of misc function > for personal use. I have recently discovered that the option > force=TRUE doesn't seem to do what is meant to do. Here's what I'm > doing: > >> setwd("/Users/danielk/Documents/R/packages/dk") >> files <- paste("codebase", dir("codebase", pattern=".R"), sep="/") >> package.skeleton(name="dk", force=TRUE, code_files=files) > Creating directories ... > Creating DESCRIPTION ... > Creating Read-and-delete-me ... > Copying code files ... > Making help files ... > Done. > Further steps are described in './dk/Read-and-delete-me'. >> > > Now, everything seems fine, but changes to files in me codebase > folder, doesn't come along if the folder dk/R already contains the > files, even though I use force=TRUE. If I remove the dk/R folder or > the dk folder altogether, the changes come along so to me it seems > that it's the overwrite part that doesn't work as it should - or am I > doing something wrong here? To me, it seems that the function > safe.dir.create (which is defined in package.skeleton never overwrites > folders, yielding force=TRUE useless. > > See below for sessionInfo. > > Thanks a bunch > Daniel > > > >> sessionInfo() > R version 2.9.0 (2009-04-17) > i386-apple-darwin8.11.1 > > locale: > en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > loaded via a namespace (and not attached): > [1] tools_2.9.0 >> > > > -- > > Contact information: > > Daniel Klevebring > M. Sc. Eng., Ph.D. Student > Dept of Gene Technology > Royal Institute of Technology, KTH > SE-106 91 Stockholm, Sweden > > Visiting address: Roslagstullsbacken 21, B3 > Delivery address: Roslagsvägen 30B, 104 06, Stockholm > Invoice address: KTH Fakturaserice, Ref DAKL KTHBIO, Box 24075, > SE-10450 Stockholm > E-mail: dan...@biotech.kth.se > Phone: +46 8 5537 8337 (Office) > Phone: +46 704 71 65 91 (Mobile) > Web: http://www.biotech.kth.se/genetech/index.html > Fax: +46 8 5537 8481 > > -- > > Contact information: > > Daniel Klevebring > M. Sc. Eng., Ph.D. Student > Dept of Gene Technology > Royal Institute of Technology, KTH > SE-106 91 Stockholm, Sweden > > Visiting address: Roslagstullsbacken 21, B3 > Delivery address: Roslagsvägen 30B, 104 06, Stockholm > Invoice address: KTH Fakturaserice, Ref DAKL KTHBIO, Box 24075, > SE-10450 Stockholm > E-mail: dan...@biotech.kth.se > Phone: +46 8 5537 8337 (Office) > Phone: +46 704 71 65 91 (Mobile) > Web: http://www.biotech.kth.se/genetech/index.html > Fax: +46 8 5537 8481 > MSN messenger: klevebr...@msn.com > > > [[alternative HTML version deleted]] > > -- Contact information: Daniel Klevebring M. Sc. Eng., Ph.D. Student Dept of Gene Technology Royal Institute of Technology, KTH SE-106 91 Stockholm, Sweden Visiting address: Roslagstullsbacken 21, B3 Delivery address: Roslagsvägen 30B, 104 06, Stockholm Invoice address: KTH Fakturaserice, Ref DAKL KTHBIO, Box 24075, SE-10450 Stockholm E-mail: dan...@biotech.kth.se Phone: +46 8 5537 8337 (Office) Phone: +46 704 71 65 91 (Mobile) Web: http://www.biotech.kth.se/genetech/index.html Fax: +46 8 5537 8481 MSN messenger: klevebr...@msn.com [[alternative HTML version deleted]] __ R-help@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.
[R] Bug in package.skeleton, R 2.9.0?
Dear all, I am using package.skeleton to build a small packages of misc function for personal use. I have recently discovered that the option force=TRUE doesn't seem to do what is meant to do. Here's what I'm doing: > setwd("/Users/danielk/Documents/R/packages/dk") > files <- paste("codebase", dir("codebase", pattern=".R"), sep="/") > package.skeleton(name="dk", force=TRUE, code_files=files) Creating directories ... Creating DESCRIPTION ... Creating Read-and-delete-me ... Copying code files ... Making help files ... Done. Further steps are described in './dk/Read-and-delete-me'. > Now, everything seems fine, but changes to files in me codebase folder, doesn't come along if the folder dk/R already contains the files, even though I use force=TRUE. If I remove the dk/R folder or the dk folder altogether, the changes come along so to me it seems that it's the overwrite part that doesn't work as it should - or am I doing something wrong here? To me, it seems that the function safe.dir.create (which is defined in package.skeleton never overwrites folders, yielding force=TRUE useless. See below for sessionInfo. Thanks a bunch Daniel > sessionInfo() R version 2.9.0 (2009-04-17) i386-apple-darwin8.11.1 locale: en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] tools_2.9.0 > -- Contact information: Daniel Klevebring M. Sc. Eng., Ph.D. Student Dept of Gene Technology Royal Institute of Technology, KTH SE-106 91 Stockholm, Sweden Visiting address: Roslagstullsbacken 21, B3 Delivery address: Roslagsvägen 30B, 104 06, Stockholm Invoice address: KTH Fakturaserice, Ref DAKL KTHBIO, Box 24075, SE-10450 Stockholm E-mail: dan...@biotech.kth.se Phone: +46 8 5537 8337 (Office) Phone: +46 704 71 65 91 (Mobile) Web: http://www.biotech.kth.se/genetech/index.html Fax: +46 8 5537 8481 -- Contact information: Daniel Klevebring M. Sc. Eng., Ph.D. Student Dept of Gene Technology Royal Institute of Technology, KTH SE-106 91 Stockholm, Sweden Visiting address: Roslagstullsbacken 21, B3 Delivery address: Roslagsvägen 30B, 104 06, Stockholm Invoice address: KTH Fakturaserice, Ref DAKL KTHBIO, Box 24075, SE-10450 Stockholm E-mail: dan...@biotech.kth.se Phone: +46 8 5537 8337 (Office) Phone: +46 704 71 65 91 (Mobile) Web: http://www.biotech.kth.se/genetech/index.html Fax: +46 8 5537 8481 MSN messenger: klevebr...@msn.com [[alternative HTML version deleted]] __ R-help@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.
[R] Bug in package.skeleton, R 2.9.0?
Dear all, I am using package.skeleton to build a small packages of misc function for personal use. I have recently discovered that the option force=TRUE doesn't seem to do what is meant to do. Here's what I'm doing: > setwd("/Users/danielk/Documents/R/packages/dk") > files <- paste("codebase", dir("codebase", pattern=".R"), sep="/") > package.skeleton(name="dk", force=TRUE, code_files=files) Creating directories ... Creating DESCRIPTION ... Creating Read-and-delete-me ... Copying code files ... Making help files ... Done. Further steps are described in './dk/Read-and-delete-me'. > Now, everything seems fine, but changes to files in me codebase folder, doesn't come along if the folder dk/R already contains the files, even though I use force=TRUE. If I remove the dk/R folder or the dk folder altogether, the changes come along so to me it seems that it's the overwrite part that doesn't work as it should - or am I doing something wrong here? See below for sessionInfo. Thanks a bunch Daniel > sessionInfo() R version 2.9.0 (2009-04-17) i386-apple-darwin8.11.1 locale: en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] tools_2.9.0 > -- Contact information: Daniel Klevebring M. Sc. Eng., Ph.D. Student Dept of Gene Technology Royal Institute of Technology, KTH SE-106 91 Stockholm, Sweden Visiting address: Roslagstullsbacken 21, B3 Delivery address: Roslagsvägen 30B, 104 06, Stockholm Invoice address: KTH Fakturaserice, Ref DAKL KTHBIO, Box 24075, SE-10450 Stockholm E-mail: dan...@biotech.kth.se Phone: +46 8 5537 8337 (Office) Phone: +46 704 71 65 91 (Mobile) Web: http://www.biotech.kth.se/genetech/index.html Fax: +46 8 5537 8481 [[alternative HTML version deleted]] __ R-help@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.