Congratulations Eva I have been following this thread loosely. Well in the sense that I really didn't understand what was going on but hopefully thinking that I could learn something from it.
Your approach to your particular setup didn't pay any attention to the heed by Duncan. So you hard headed (pig headed, stubborn as a monkey) wanted it to be your way. Now I guess you accidentally found the error you introduced between R-3.0.2 and R-3.1.0. Thank you for your persistent work that took you a step further to doing it all wrong in R. And thanks to Duncan for adding invaluable help to this list. Br. Frede Sendt fra Samsung mobil -------- Oprindelig meddelelse -------- Fra: Eva Prieto Castro Dato:08/07/2014 18.39 (GMT+01:00) Til: Duncan Murdoch Cc: r-help Emne: Re: [R] [R-es] Consulta paquetización con versión R 3.1.0 Solved!! I removed this line: .ChrL.env$bStarted <- FALSE And run ok!! I supose the method let the fact of initializing data structure, but not the fact of assign. The basic example runs ok. Now I have to test all the project. Thanks!! Eva 2014-07-08 13:02 GMT+02:00 Eva Prieto Castro <eva.pcastro.l...@gmail.com>: > Duncan, > > Not always the .ChrL.env is non-existent, but also the functions in the > package (when I use the package) do not find it. If you ChrL.Start it does > not find the environment created. > > The situation is like (at all effects) the environment created was beeing > obviated by the package. > > Eva > > > 2014-07-08 12:55 GMT+02:00 Eva Prieto Castro <eva.pcastro.l...@gmail.com>: > >> Duncan, >> >> I don't export it in the sense that I dont't include it in namespaces as >> "export()" because it is not a function. Simply I include it in >> ChrL-internal.r, as follows: >> >> .ChrL.env <- new.env() >> >> >> I always dit it in this way and it run (simple past!) ok, but now it does >> not run and I don't know the reason. >> >> Thanks. >> >> Eva >> >> >> 2014-07-08 12:49 GMT+02:00 Duncan Murdoch <murdoch.dun...@gmail.com>: >> >>> On 08/07/2014, 12:56 AM, Eva Prieto Castro wrote: >>> > Duncan, >>> > >>> > Yes, it has exactly that line. >>> > >>> > I know it does not exists because of this: >>> > >>> >> library("ChrL") >>> >> .ChrL.env >>> > Error: objeto '.ChrL.env' no encontrado >>> >>> That says that you did not export it. It is only visible from code >>> within the package. >>> >>> Duncan Murdoch >>> >>> > >>> > >>> > >>> > However, it should be as follows: >>> > >>> >> library("ChrL") >>> >> .ChrL.env >>> > <environment: 0x00000000091eb898> >>> > >>> > >>> > I'm desperate; I have to solve this urgently and I don't find the >>> solution. >>> > >>> > Thanks again. >>> > >>> > Eva >>> > >>> > >>> > 2014-07-08 1:56 GMT+02:00 Duncan Murdoch <murdoch.dun...@gmail.com >>> > <mailto:murdoch.dun...@gmail.com>>: >>> > >>> > On 07/07/2014, 7:13 PM, Eva Prieto Castro wrote: >>> > > Duncan, >>> > > >>> > > The ChrL folder has the following components: >>> > > >>> > > * Description file >>> > > * Namespace file >>> > > * R folder, including 3 files: CheckGloCreated.r, ChrL.Start.r >>> and >>> > > ChrL-internal.r >>> > > >>> > >>> > And does ChrL-internal.r contain just one line as you said before, >>> i.e. >>> > >>> > .ChrL.env <- new.env() >>> > >>> > ? >>> > >>> > If so, how have you determined that .ChrL.env does not exist? >>> Names >>> > that start with a "." don't show up in ls() listings by default. >>> You >>> > can't use exists() to test for .ChrL.env in either of the other >>> files, >>> > because they are probably sourced before it is (depending on the >>> > collation order). It won't exist when you run them, but it will >>> exist >>> > in the package namespace when you load the package. >>> > >>> > Duncan Murdoch >>> > >>> > > Obs.: Sometimes I remove man folder and another I adjust the rd >>> files. >>> > > In all cases the result is the same:.ChrL.env does not exist!. >>> > > >>> > > Description file: >>> > > >>> > > Package: ChrL >>> > > Type: Package >>> > > Title: What the package does (short line) >>> > > Version: 1.0 >>> > > Date: 2014-07-08 >>> > > Author: Eva Prieto Castro >>> > > Maintainer: Eva Prieto Castro <yourfa...@somewhere.net >>> > <mailto:yourfa...@somewhere.net> >>> > > <mailto:yourfa...@somewhere.net <mailto:yourfa...@somewhere.net >>> >>> >>> > > Description: Test Pkg >>> > > License: Unlimited >>> > > >>> > > Namespace file: >>> > > exportPattern("^[[:alpha:]]+") >>> > > >>> > > I also test with this namespace file: >>> > > export(ChrL.Start) >>> > > >>> > > Thank you very much, again. >>> > > >>> > > Eva >>> > > >>> > > >>> > > 2014-07-08 0:55 GMT+02:00 Duncan Murdoch < >>> murdoch.dun...@gmail.com >>> > <mailto:murdoch.dun...@gmail.com> >>> > > <mailto:murdoch.dun...@gmail.com <mailto: >>> murdoch.dun...@gmail.com>>>: >>> > > >>> > > On 07/07/2014, 6:39 PM, Eva Prieto Castro wrote: >>> > > > Hi again, Duncan >>> > > > >>> > > > I think I must tell you all the details of the method I >>> use, in >>> > > order to >>> > > > make possible you notice my error. >>> > > >>> > > Your error is in calling package.skeleton. As I said before, >>> > you should >>> > > have done this once, when you first thought of creating the >>> ChrL >>> > > package, and *you should never call it again* for that >>> package. >>> > > >>> > > The normal workflow after the single call to that function is >>> > to edit >>> > > the files in the ChrL directory. Don't call package.skeleton >>> > again. >>> > > >>> > > If you want to describe the problems you are having, you >>> should be >>> > > describing the contents of the ChrL directory, not how they >>> were >>> > > created. That is normally irrelevant, except that in your >>> > case, I think >>> > > that is the source of the problem. >>> > > >>> > > Duncan Murdoch >>> > > >>> > > However, you must know that this >>> > > > method run on 3.0.1 version (not in 3.0.2 and not in >>> 3.1.0; this >>> > > is the >>> > > > problem!). >>> > > > >>> > > > 1) This is my code in "D:/probando.r" : >>> > > > >>> > > > >>> > > > .ChrL.env <- new.env() >>> > > > .ChrL.env$lGlo <- list() >>> > > > .ChrL.env$bStarted <- FALSE >>> > > > >>> > > > CheckGloCreated <- function() { >>> > > > if (.ChrL.env$bStarted == TRUE) { >>> > > > stop("Data structures were already initialized.", >>> > call.=FALSE) >>> > > > } >>> > > > } >>> > > > ChrL.Start <- function() { >>> > > > CheckGloCreated() >>> > > > cat("Tested.\n") >>> > > > } >>> > > > >>> > > > 2) I open RGUI and run the following: >>> > > > >>> > > > setwd("D:/") >>> > > > source("probando.r", encoding="utf-8") >>> > > > package.skeleton(name="ChrL", path="D:/") >>> > > > >>> > > > 3) At this point, ChrL folder has been created in D:/, so I >>> > adjust >>> > > > Description and Namespace files. In R folder, >>> > ChrL-internal.r file >>> > > is as >>> > > > I indicate below... >>> > > > >>> > > >>> >>> > > >>> >>> > > >>> My Namespace: >>> > > >>> >>> > > >>> export(ChrL.Start) >>> > > >>> >>> > > >>> >>> > > >>> My ChrL-internal.R: >>> > > >>> >>> > > >>> .ChrL.env <- new.env() >>> > > > >>> > > > 3) I go to bin folder (C:/Program Files/R/R-3.1.0/bin) and >>> > run the >>> > > > following: >>> > > > >>> > > > R CMD INSTALL D:/ChrL >>> > > > >>> > > > R CMD check D:/ChrL >>> > > > >>> > > > R CMD build D:/ChrL >>> > > > >>> > > > R CMD INSTALL --build D:/ChrL >>> > > > >>> > > > Consequently, zip is generated, and I load it in RGUI. >>> Then I do >>> > > > "library(ChrL)", but I see .ChrL.env does not exists. ¡In >>> 3.0.1 >>> > > version >>> > > > it run ok!. What is the reason why in 3.1.0 version It >>> does not >>> > > exists?. >>> > > > >>> > > > >>> > > > Thanks again. >>> > > > >>> > > > Eva >>> > > > >>> > > > >>> > > > 2014-07-07 22:49 GMT+02:00 Duncan Murdoch >>> > > <murdoch.dun...@gmail.com <mailto:murdoch.dun...@gmail.com> >>> > <mailto:murdoch.dun...@gmail.com <mailto:murdoch.dun...@gmail.com >>> >> >>> > > > <mailto:murdoch.dun...@gmail.com >>> > <mailto:murdoch.dun...@gmail.com> <mailto:murdoch.dun...@gmail.com >>> > <mailto:murdoch.dun...@gmail.com>>>>: >>> > > > >>> > > > On 07/07/2014, 2:02 PM, Eva Prieto Castro wrote: >>> > > > > Hi eveybody, >>> > > > > >>> > > > > I think the problem is with the package.skeleton >>> function, >>> > > because >>> > > > of the >>> > > > > changes made in version 3.0.2. Since that version the >>> > > management of >>> > > > > environment parameter is different and I think it can >>> > > justify the >>> > > > fact of >>> > > > > package.skeleton is not considering my environment. I >>> > have not >>> > > > tested it >>> > > > > yet. >>> > > > >>> > > > The package.skeleton() function is intended to be used >>> > once as >>> > > a quick >>> > > > setup of a new package; you shouldn't be using it >>> routinely. >>> > > After the >>> > > > first quick setup, you should edit the source of the >>> package >>> > > to get what >>> > > > you want. >>> > > > >>> > > > A few more comments inline... >>> > > > >>> > > > > >>> > > > > Regards. >>> > > > > >>> > > > > Eva >>> > > > > >>> > > > > >>> > > > > 2014-07-07 10:21 GMT+02:00 Eva Prieto Castro >>> > > <evapcas...@yahoo.es <mailto:evapcas...@yahoo.es> >>> > <mailto:evapcas...@yahoo.es <mailto:evapcas...@yahoo.es>> >>> > > > <mailto:evapcas...@yahoo.es <mailto: >>> evapcas...@yahoo.es> >>> > <mailto:evapcas...@yahoo.es <mailto:evapcas...@yahoo.es>>>>: >>> > > > > >>> > > > >> Hi everybody >>> > > > >> >>> > > > >> I have a very big problem: >>> > > > >> >>> > > > >> With R 3.0.2 I could construct the package for this >>> code: >>> > > > >> >>> > > > >> >>> > > > >> if (exists('.ChrL.env') == TRUE) { >>> > > > >> rm(.ChrL.env) >>> > > > >> } >>> > > > >>> > > > The code above doesn't make sense in a package: >>> either you >>> > > created the >>> > > > environment, or you didn't. That code will look >>> through >>> > attached >>> > > > packages, and if one of them has a variable of that >>> > name, will >>> > > try to >>> > > > remove it (but will likely fail to do so). >>> > > > >>> > > > >> >>> > > > >> .ChrL.env <- new.env() >>> > > > >> .ChrL.env$lGlo <- list() >>> > > > >> .ChrL.env$bStarted <- FALSE >>> > > > >> >>> > > > >> CheckGloCreated <- function() { >>> > > > >> if (.ChrL.env$bStarted == TRUE) { >>> > > > >> stop("Data structures were already >>> initialized.", >>> > > call.=FALSE) >>> > > > >> } >>> > > > >> } >>> > > > >> ChrL.Start <- function() { >>> > > > >> CheckGloCreated() >>> > > > >> >>> > > > >> cat("Libraries have been loaded and data structure >>> > has been >>> > > > >> initialized.\n") >>> > > > >> } >>> > > > >> >>> > > > >> >>> > > > >> >>> > > > >> As you can do, I used an own environment >>> (.ChrL.env). >>> > > > >> >>> > > > >> >>> > > > >> Now, with R 3.1.0, I construct the package and I >>> load it >>> > > but it seems >>> > > > >> .ChrL.env does not exists. >>> > > > >> >>> > > > >> >>> > > > >> The method I use is the following: >>> > > > >> >>> > > > >> >>> > > > >> rm(list=ls()) >>> > > > >> >>> > > > >> setwd("D:/probando") >>> > > > >> >>> > > > >> source("probando.r", encoding="utf-8") >>> > > > >> >>> > > > >> package.skeleton(name="ChrL", path="D:/probando") >>> > > > >>> > > > This says that you read the file >>> d:/probando/probando.r, >>> > then >>> > > created a >>> > > > package in the same directory. Don't do that. Create >>> > the package >>> > > > somewhere else, and copy the source to your functions >>> > into the R >>> > > > subdirectory that gets created. >>> > > > >>> > > > >> >>> > > > >> >>> > > > >> My Namespace: >>> > > > >> >>> > > > >> export(ChrL.Start) >>> > > > >> >>> > > > >> >>> > > > >> My ChrL-internal.R: >>> > > > >> >>> > > > >> .ChrL.env <- new.env() >>> > > > >>> > > > As far as I can see, you never added this to the >>> > package, so the >>> > > > environment wouldn't be created. >>> > > > >>> > > > Duncan Murdoch >>> > > > >>> > > > >> >>> > > > >> >>> > > > >> Could you help me, please?. It is very urgent... >>> > > > >> >>> > > > >> >>> > > > >> My project is more complex that the example I put, >>> > but I have >>> > > > tested with >>> > > > >> this simple example and the problem is the same. >>> > > > >> >>> > > > >> >>> > > > >> Thank you in advance. >>> > > > >> >>> > > > >> >>> > > > >> Regards, >>> > > > >> >>> > > > >> Eva >>> > > > >> [[alternative HTML version deleted]] >>> > > > >> >>> > > > >> >>> > > > >> _______________________________________________ >>> > > > >> R-help-es mailing list >>> > > > >> r-help...@r-project.org >>> > <mailto:r-help...@r-project.org> <mailto:r-help...@r-project.org >>> > <mailto:r-help...@r-project.org>> >>> > > <mailto:r-help...@r-project.org >>> > <mailto:r-help...@r-project.org> <mailto:r-help...@r-project.org >>> > <mailto:r-help...@r-project.org>>> >>> > > > >> https://stat.ethz.ch/mailman/listinfo/r-help-es >>> > > > >> >>> > > > >> >>> > > > > >>> > > > > [[alternative HTML version deleted]] >>> > > > > >>> > > > > ______________________________________________ >>> > > > > R-help@r-project.org <mailto:R-help@r-project.org> >>> > <mailto:R-help@r-project.org <mailto:R-help@r-project.org>> >>> > > <mailto:R-help@r-project.org <mailto:R-help@r-project.org> >>> > <mailto:R-help@r-project.org <mailto: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. >>> > > > > >>> > > > >>> > > > >>> > > >>> > > >>> > >>> > >>> >>> >> > [[alternative HTML version deleted]] [[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.