Re: [R] Problem with global variable building a package

2012-08-17 Thread Eva Prieto Castro
Hi,

I could build the package, finally, adjusting the path correctly (Rtools 
folders in front).

Regards

Eva

--- El jue, 16/8/12, Eva Prieto Castro evapcas...@yahoo.es escribió:

De: Eva Prieto Castro evapcas...@yahoo.es
Asunto: Re: [R] Problem with global variable building a package
Para: Uwe Ligges lig...@statistik.tu-dortmund.de
CC: Greg Snow 538...@gmail.com, R-help@r-project.org
Fecha: jueves, 16 de agosto, 2012 10:50

I forget one question:

Where do I indicate this path? :

PATH=c:\Rtools\bin;c:\Rtools\gcc-4.6.3\bin;c:\MiKTeX\miktex\bin;
c:\R\R-2.15\bin\i386;c:\windows;c:\windows\system32

Regards,
Eva

--- El jue, 16/8/12, Eva Prieto Castro evapcas...@yahoo.es escribió:

De: Eva Prieto Castro evapcas...@yahoo.es
Asunto: Re: [R] Problem with global variable building a package
Para: Uwe Ligges lig...@statistik.tu-dortmund.de
CC: Greg Snow 538...@gmail.com, R-help@r-project.org
Fecha: jueves, 16 de agosto, 2012 10:41

Hi,

I altered .internal file
 as Ligges indicated, but I have a problem when I make R CMD build pkg: 

ERROR
packaging into .tar.gz failed

The question is the following: what is the problem? I have installed Rtools, 
Must I do anything else?. 

Obs.: I work under Windows 7, but the package generated will be used under 
windows and mac.

Thanks in advance.

Eva

--- El mié, 8/8/12, Uwe Ligges lig...@statistik.tu-dortmund.de escribió:

De: Uwe Ligges lig...@statistik.tu-dortmund.de
Asunto: Re: [R] Problem with global variable building a package
Para: Eva Prieto Castro evapcas...@yahoo.es
CC: Greg Snow 538...@gmail.com,
 R-help@r-project.org
Fecha: miércoles, 8 de agosto, 2012 11:24



On 08.08.2012 08:53, Eva Prieto Castro wrote:
 Hello, Greg:

 That is one of the solutions I have tried; the problem is that I can't obtain 
 a package in this way, because an glo-internal.R file is generated (glo is 
 the name of the package) and when I try to create the package an error 
 message appears (a parse error).

 The content of the glo-internal.R file is the following:

 .glo.env -
 environment


To avoid parser errors, replace  environment by something that is 
syntactically valid, in this case: new.env().

Best,
Uwe Ligges



 where .glo.env is the name of the new environment I create in my source code.

 What am I doing wrong?.

 Thanks again for your help.


 Regards.

 Eva

 --- El mar, 7/8/12, Greg Snow 538...@gmail.com escribió:

 De: Greg Snow 538...@gmail.com
 Asunto: Re: [R] Problem with global variable building a package
 Para: Eva Prieto Castro evapcas...@yahoo.es
 CC: R-help@r-project.org
 Fecha: martes, 7 de agosto, 2012 23:30

 Probably the best thing to do is create an environment within the
 package that you can assign to and read from.

 Somewhere in the source code for the package include a line like:

 my.env -
 new.env()

 then within any functions defined after that line you can set
 variables within the environment with code like:

   my.env$paramA - 3

 and other functions can then read my.env$paramA.  This way you don't
 need to worry about assign or - and all your functions will have
 access to the same set of variables (but they won't interfere with the
 users workspace).

 On Tue, Aug 7, 2012 at 1:09 AM, Eva Prieto Castro evapcas...@yahoo.es wrote:


 Hi,



 My name is
 Eva and this is my first message here. My English is not very good, but I 
 hope
 you can understand my question, in the context of an academic
 project.



 I have
 developed several functions in R and the
 idea is that the user can access functions in order to:



 1)
 Alter
 parameters in relation with data and type of analysis.

 2)
 Run
 statistical analysis (Text and pdf files with results will be generated).

 3)
 View
 the value of the most important parameters.



 All the
 parameters I need are stored in a list object, and this list is used in all 
 the
 functions along the cycle performed by the user, but I would like the user 
 does
 not need to pass the name of the list as argument when he/she runs the 
 different
 functions, so I think I need to treat the list as a global
 variable.



 Firstly, I
 used the global assignment operator (“-“); secondly, I used 
 “get� and “assign�
 functions and even I used a new.env() in order to use a new environment
 exclusively for my list. However, when I try to build a package with all my
 functions I don’t reach this end, because of an error in parse 
 process.



 My question
 for you is the following: taking into account that my end is to build a
 package, what can I do with this “global� list?. How can I 
 treat it?.



 Thanks in
 advance.



 Regards,

 Eva




         Â
 [[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

Re: [R] Problem with global variable building a package

2012-08-16 Thread Eva Prieto Castro
Hi,

I altered .internal file as Ligges indicated, but I have a problem when I make 
R CMD build pkg: 

ERROR
packaging into .tar.gz failed

The question is the following: what is the problem? I have installed Rtools, 
Must I do anything else?. 

Obs.: I work under Windows 7, but the package generated will be used under 
windows and mac.

Thanks in advance.

Eva

--- El mié, 8/8/12, Uwe Ligges lig...@statistik.tu-dortmund.de escribió:

De: Uwe Ligges lig...@statistik.tu-dortmund.de
Asunto: Re: [R] Problem with global variable building a package
Para: Eva Prieto Castro evapcas...@yahoo.es
CC: Greg Snow 538...@gmail.com, R-help@r-project.org
Fecha: miércoles, 8 de agosto, 2012 11:24



On 08.08.2012 08:53, Eva Prieto Castro wrote:
 Hello, Greg:

 That is one of the solutions I have tried; the problem is that I can't obtain 
 a package in this way, because an glo-internal.R file is generated (glo is 
 the name of the package) and when I try to create the package an error 
 message appears (a parse error).

 The content of the glo-internal.R file is the following:

 .glo.env -
 environment


To avoid parser errors, replace  environment by something that is 
syntactically valid, in this case: new.env().

Best,
Uwe Ligges



 where .glo.env is the name of the new environment I create in my source code.

 What am I doing wrong?.

 Thanks again for your help.

 Regards.

 Eva

 --- El mar, 7/8/12, Greg Snow 538...@gmail.com escribió:

 De: Greg Snow 538...@gmail.com
 Asunto: Re: [R] Problem with global variable building a package
 Para: Eva Prieto Castro evapcas...@yahoo.es
 CC: R-help@r-project.org
 Fecha: martes, 7 de agosto, 2012 23:30

 Probably the best thing to do is create an environment within the
 package that you can assign to and read from.

 Somewhere in the source code for the package include a line like:

 my.env - new.env()

 then within any functions defined after that line you can set
 variables within the environment with code like:

   my.env$paramA - 3

 and other functions can then read my.env$paramA.  This way you don't
 need to worry about assign or - and all your functions will have
 access to the same set of variables (but they won't interfere with the
 users workspace).

 On Tue, Aug 7, 2012 at 1:09 AM, Eva Prieto Castro evapcas...@yahoo.es wrote:


 Hi,



 My name is
 Eva and this is my first message here. My English is not very good, but I 
 hope
 you can understand my question, in the context of an academic project.



 I have
 developed several functions in R and the
 idea is that the user can access functions in order to:



 1)
 Alter
 parameters in relation with data and type of analysis.

 2)
 Run
 statistical analysis (Text and pdf files with results will be generated).

 3)
 View
 the value of the most important parameters.



 All the
 parameters I need are stored in a list object, and this list is used in all 
 the
 functions along the cycle performed by the user, but I would like the user 
 does
 not need to pass the name of the list as argument when he/she runs the 
 different
 functions, so I think I need to treat the list as a global variable.



 Firstly, I
 used the global assignment operator (“-“); secondly, I used 
 “get� and “assign�
 functions and even I used a new.env() in order to use a new environment
 exclusively for my list. However, when I try to build a package with all my
 functions I don’t reach this end, because of an error in parse 
 process.



 My question
 for you is the following: taking into account that my end is to build a
 package, what can I do with this “global� list?. How can I 
 treat it?.



 Thanks in
 advance.



 Regards,

 Eva




          [[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-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]]

__
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.


Re: [R] Problem with global variable building a package

2012-08-16 Thread Eva Prieto Castro
I forget one question:

Where do I indicate this path? :

PATH=c:\Rtools\bin;c:\Rtools\gcc-4.6.3\bin;c:\MiKTeX\miktex\bin;
c:\R\R-2.15\bin\i386;c:\windows;c:\windows\system32

Regards,
Eva

--- El jue, 16/8/12, Eva Prieto Castro evapcas...@yahoo.es escribió:

De: Eva Prieto Castro evapcas...@yahoo.es
Asunto: Re: [R] Problem with global variable building a package
Para: Uwe Ligges lig...@statistik.tu-dortmund.de
CC: Greg Snow 538...@gmail.com, R-help@r-project.org
Fecha: jueves, 16 de agosto, 2012 10:41

Hi,

I altered .internal file as Ligges indicated, but I have a problem when I make 
R CMD build pkg: 

ERROR
packaging into .tar.gz failed

The question is the following: what is the problem? I have installed Rtools, 
Must I do anything else?. 

Obs.: I work under Windows 7, but the package generated will be used under 
windows and mac.

Thanks in advance.

Eva

--- El mié, 8/8/12, Uwe Ligges lig...@statistik.tu-dortmund.de escribió:

De: Uwe Ligges lig...@statistik.tu-dortmund.de
Asunto: Re: [R] Problem with global variable building a package
Para: Eva Prieto Castro evapcas...@yahoo.es
CC: Greg Snow 538...@gmail.com,
 R-help@r-project.org
Fecha: miércoles, 8 de agosto, 2012 11:24



On 08.08.2012 08:53, Eva Prieto Castro wrote:
 Hello, Greg:

 That is one of the solutions I have tried; the problem is that I can't obtain 
 a package in this way, because an glo-internal.R file is generated (glo is 
 the name of the package) and when I try to create the package an error 
 message appears (a parse error).

 The content of the glo-internal.R file is the following:

 .glo.env -
 environment


To avoid parser errors, replace  environment by something that is 
syntactically valid, in this case: new.env().

Best,
Uwe Ligges



 where .glo.env is the name of the new environment I create in my source code.

 What am I doing wrong?.

 Thanks again for your help.


 Regards.

 Eva

 --- El mar, 7/8/12, Greg Snow 538...@gmail.com escribió:

 De: Greg Snow 538...@gmail.com
 Asunto: Re: [R] Problem with global variable building a package
 Para: Eva Prieto Castro evapcas...@yahoo.es
 CC: R-help@r-project.org
 Fecha: martes, 7 de agosto, 2012 23:30

 Probably the best thing to do is create an environment within the
 package that you can assign to and read from.

 Somewhere in the source code for the package include a line like:

 my.env -
 new.env()

 then within any functions defined after that line you can set
 variables within the environment with code like:

   my.env$paramA - 3

 and other functions can then read my.env$paramA.  This way you don't
 need to worry about assign or - and all your functions will have
 access to the same set of variables (but they won't interfere with the
 users workspace).

 On Tue, Aug 7, 2012 at 1:09 AM, Eva Prieto Castro evapcas...@yahoo.es wrote:


 Hi,



 My name is
 Eva and this is my first message here. My English is not very good, but I 
 hope
 you can understand my question, in the context of an academic
 project.



 I have
 developed several functions in R and the
 idea is that the user can access functions in order to:



 1)
 Alter
 parameters in relation with data and type of analysis.

 2)
 Run
 statistical analysis (Text and pdf files with results will be generated).

 3)
 View
 the value of the most important parameters.



 All the
 parameters I need are stored in a list object, and this list is used in all 
 the
 functions along the cycle performed by the user, but I would like the user 
 does
 not need to pass the name of the list as argument when he/she runs the 
 different
 functions, so I think I need to treat the list as a global
 variable.



 Firstly, I
 used the global assignment operator (“-“); secondly, I used 
 “get� and “assign�
 functions and even I used a new.env() in order to use a new environment
 exclusively for my list. However, when I try to build a package with all my
 functions I don’t reach this end, because of an error in parse 
 process.



 My question
 for you is the following: taking into account that my end is to build a
 package, what can I do with this “global� list?. How can I 
 treat it?.



 Thanks in
 advance.



 Regards,

 Eva




         Â
 [[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-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]]

__
R-help@r-project.org mailing

Re: [R] Problem with global variable building a package

2012-08-08 Thread Eva Prieto Castro
Hello, Greg:

That is one of the solutions I have tried; the problem is that I can't obtain a 
package in this way, because an glo-internal.R file is generated (glo is the 
name of the package) and when I try to create the package an error message 
appears (a parse error).

The content of the glo-internal.R file is the following:

.glo.env -
environment

where .glo.env is the name of the new environment I create in my source code.

What am I doing wrong?.

Thanks again for your help.

Regards.

Eva

--- El mar, 7/8/12, Greg Snow 538...@gmail.com escribió:

De: Greg Snow 538...@gmail.com
Asunto: Re: [R] Problem with global variable building a package
Para: Eva Prieto Castro evapcas...@yahoo.es
CC: R-help@r-project.org
Fecha: martes, 7 de agosto, 2012 23:30

Probably the best thing to do is create an environment within the
package that you can assign to and read from.

Somewhere in the source code for the package include a line like:

my.env - new.env()

then within any functions defined after that line you can set
variables within the environment with code like:

  my.env$paramA - 3

and other functions can then read my.env$paramA.  This way you don't
need to worry about assign or - and all your functions will have
access to the same set of variables (but they won't interfere with the
users workspace).

On Tue, Aug 7, 2012 at 1:09 AM, Eva Prieto Castro evapcas...@yahoo.es wrote:


 Hi,



 My name is
 Eva and this is my first message here. My English is not very good, but I hope
 you can understand my question, in the context of an academic project.



 I have
 developed several functions in R and the
 idea is that the user can access functions in order to:



 1)
 Alter
 parameters in relation with data and type of analysis.

 2)
 Run
 statistical analysis (Text and pdf files with results will be generated).

 3)
 View
 the value of the most important parameters.



 All the
 parameters I need are stored in a list object, and this list is used in all 
 the
 functions along the cycle performed by the user, but I would like the user 
 does
 not need to pass the name of the list as argument when he/she runs the 
 different
 functions, so I think I need to treat the list as a global variable.



 Firstly, I
 used the global assignment operator (“-“); secondly, I used “get” 
 and “assign”
 functions and even I used a new.env() in order to use a new environment
 exclusively for my list. However, when I try to build a package with all my
 functions I don’t reach this end, because of an error in parse process.



 My question
 for you is the following: taking into account that my end is to build a
 package, what can I do with this “global” list?. How can I treat it?.



 Thanks in
 advance.



 Regards,

 Eva




         [[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.




-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.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.


Re: [R] Problem with global variable building a package

2012-08-08 Thread Eva Prieto Castro
Hi Michael,

I did not know those alternatives you mention (setCompilerOptions() and 
setRmetricsOptions()), so I will study them (apart to find out why I can not 
create a package when I use a new environment, as I was telling Greg). 

Thanks again for your help.

Regards.

Eva


--- El mar, 7/8/12, R. Michael Weylandt michael.weyla...@gmail.com escribió:

De: R. Michael Weylandt michael.weyla...@gmail.com
Asunto: Re: [R] Problem with global variable building a package
Para: Eva Prieto Castro evapcas...@yahoo.es
CC: R-help@r-project.org
Fecha: martes, 7 de agosto, 2012 20:35

On Tue, Aug 7, 2012 at 2:09 AM, Eva Prieto Castro evapcas...@yahoo.es wrote:


 Hi,



 My name is
 Eva and this is my first message here. My English is not very good, but I hope
 you can understand my question, in the context of an academic project.



 I have
 developed several functions in R and the
 idea is that the user can access functions in order to:



 1)
 Alter
 parameters in relation with data and type of analysis.

 2)
 Run
 statistical analysis (Text and pdf files with results will be generated).

 3)
 View
 the value of the most important parameters.



 All the
 parameters I need are stored in a list object, and this list is used in all 
 the
 functions along the cycle performed by the user, but I would like the user 
 does
 not need to pass the name of the list as argument when he/she runs the 
 different
 functions, so I think I need to treat the list as a global variable.



 Firstly, I
 used the global assignment operator (“-“); secondly, I used “get” 
 and “assign”
 functions and even I used a new.env() in order to use a new environment
 exclusively for my list. However, when I try to build a package with all my
 functions I don’t reach this end, because of an error in parse process.



 My question
 for you is the following: taking into account that my end is to build a
 package, what can I do with this “global” list?. How can I treat it?.

Hi Eva,

I was actually doing something similar just the other day -- for a
quick and dirty solution, you can use assignInNamespace() or
assignInMyNamespace() but the help pages suggest CRAN won't look
kindly thereupon. To avoid that, I simply used a hidden [starting with
a dot] variable in the user's global environment (i.e., I defined it
on package load with the .onAttach() function and then just referenced
it when needed) but the best practices solution is probably to use
options() or something similar. See, e.g., setCompilerOptions() of the
compiler package or setRmetricsOptions() of the Rmetrics bundle.

Best,
Michael





 Thanks in
 advance.



 Regards,

 Eva




         [[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.


[[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.


Re: [R] Problem with global variable building a package

2012-08-08 Thread Uwe Ligges



On 08.08.2012 08:53, Eva Prieto Castro wrote:

Hello, Greg:

That is one of the solutions I have tried; the problem is that I can't obtain a 
package in this way, because an glo-internal.R file is generated (glo is the 
name of the package) and when I try to create the package an error message 
appears (a parse error).

The content of the glo-internal.R file is the following:

.glo.env -
environment



To avoid parser errors, replace  environment by something that is 
syntactically valid, in this case: new.env().


Best,
Uwe Ligges




where .glo.env is the name of the new environment I create in my source code.

What am I doing wrong?.

Thanks again for your help.

Regards.

Eva

--- El mar, 7/8/12, Greg Snow 538...@gmail.com escribió:

De: Greg Snow 538...@gmail.com
Asunto: Re: [R] Problem with global variable building a package
Para: Eva Prieto Castro evapcas...@yahoo.es
CC: R-help@r-project.org
Fecha: martes, 7 de agosto, 2012 23:30

Probably the best thing to do is create an environment within the
package that you can assign to and read from.

Somewhere in the source code for the package include a line like:

my.env - new.env()

then within any functions defined after that line you can set
variables within the environment with code like:

  my.env$paramA - 3

and other functions can then read my.env$paramA.  This way you don't
need to worry about assign or - and all your functions will have
access to the same set of variables (but they won't interfere with the
users workspace).

On Tue, Aug 7, 2012 at 1:09 AM, Eva Prieto Castro evapcas...@yahoo.es wrote:



Hi,



My name is
Eva and this is my first message here. My English is not very good, but I hope
you can understand my question, in the context of an academic project.



I have
developed several functions in R and the
idea is that the user can access functions in order to:



1)
Alter
parameters in relation with data and type of analysis.

2)
Run
statistical analysis (Text and pdf files with results will be generated).

3)
View
the value of the most important parameters.



All the
parameters I need are stored in a list object, and this list is used in all the
functions along the cycle performed by the user, but I would like the user does
not need to pass the name of the list as argument when he/she runs the different
functions, so I think I need to treat the list as a global variable.



Firstly, I
used the global assignment operator (“-“); secondly, I used “get� and 
“assign�
functions and even I used a new.env() in order to use a new environment
exclusively for my list. However, when I try to build a package with all my
functions I don’t reach this end, because of an error in parse process.



My question
for you is the following: taking into account that my end is to build a
package, what can I do with this “global� list?. How can I treat it?.



Thanks in
advance.



Regards,

Eva




         [[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-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-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] Problem with global variable building a package

2012-08-07 Thread Eva Prieto Castro


Hi,

 

My name is
Eva and this is my first message here. My English is not very good, but I hope
you can understand my question, in the context of an academic project.

 

I have
developed several functions in R and the
idea is that the user can access functions in order to:

 

1)     
Alter
parameters in relation with data and type of analysis.

2)     
Run
statistical analysis (Text and pdf files with results will be generated).

3)     
View
the value of the most important parameters.

 

All the
parameters I need are stored in a list object, and this list is used in all the
functions along the cycle performed by the user, but I would like the user does
not need to pass the name of the list as argument when he/she runs the different
functions, so I think I need to treat the list as a global variable.

 

Firstly, I
used the global assignment operator (“-“); secondly, I used “get” and 
“assign”
functions and even I used a new.env() in order to use a new environment
exclusively for my list. However, when I try to build a package with all my
functions I don’t reach this end, because of an error in parse process.

 

My question
for you is the following: taking into account that my end is to build a
package, what can I do with this “global” list?. How can I treat it?.

 

Thanks in
advance.

 

Regards,

Eva

 


[[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.


Re: [R] Problem with global variable building a package

2012-08-07 Thread R. Michael Weylandt
On Tue, Aug 7, 2012 at 2:09 AM, Eva Prieto Castro evapcas...@yahoo.es wrote:


 Hi,



 My name is
 Eva and this is my first message here. My English is not very good, but I hope
 you can understand my question, in the context of an academic project.



 I have
 developed several functions in R and the
 idea is that the user can access functions in order to:



 1)
 Alter
 parameters in relation with data and type of analysis.

 2)
 Run
 statistical analysis (Text and pdf files with results will be generated).

 3)
 View
 the value of the most important parameters.



 All the
 parameters I need are stored in a list object, and this list is used in all 
 the
 functions along the cycle performed by the user, but I would like the user 
 does
 not need to pass the name of the list as argument when he/she runs the 
 different
 functions, so I think I need to treat the list as a global variable.



 Firstly, I
 used the global assignment operator (“-“); secondly, I used “get” and 
 “assign”
 functions and even I used a new.env() in order to use a new environment
 exclusively for my list. However, when I try to build a package with all my
 functions I don’t reach this end, because of an error in parse process.



 My question
 for you is the following: taking into account that my end is to build a
 package, what can I do with this “global” list?. How can I treat it?.

Hi Eva,

I was actually doing something similar just the other day -- for a
quick and dirty solution, you can use assignInNamespace() or
assignInMyNamespace() but the help pages suggest CRAN won't look
kindly thereupon. To avoid that, I simply used a hidden [starting with
a dot] variable in the user's global environment (i.e., I defined it
on package load with the .onAttach() function and then just referenced
it when needed) but the best practices solution is probably to use
options() or something similar. See, e.g., setCompilerOptions() of the
compiler package or setRmetricsOptions() of the Rmetrics bundle.

Best,
Michael





 Thanks in
 advance.



 Regards,

 Eva




 [[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-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.


Re: [R] Problem with global variable building a package

2012-08-07 Thread Greg Snow
Probably the best thing to do is create an environment within the
package that you can assign to and read from.

Somewhere in the source code for the package include a line like:

my.env - new.env()

then within any functions defined after that line you can set
variables within the environment with code like:

  my.env$paramA - 3

and other functions can then read my.env$paramA.  This way you don't
need to worry about assign or - and all your functions will have
access to the same set of variables (but they won't interfere with the
users workspace).

On Tue, Aug 7, 2012 at 1:09 AM, Eva Prieto Castro evapcas...@yahoo.es wrote:


 Hi,



 My name is
 Eva and this is my first message here. My English is not very good, but I hope
 you can understand my question, in the context of an academic project.



 I have
 developed several functions in R and the
 idea is that the user can access functions in order to:



 1)
 Alter
 parameters in relation with data and type of analysis.

 2)
 Run
 statistical analysis (Text and pdf files with results will be generated).

 3)
 View
 the value of the most important parameters.



 All the
 parameters I need are stored in a list object, and this list is used in all 
 the
 functions along the cycle performed by the user, but I would like the user 
 does
 not need to pass the name of the list as argument when he/she runs the 
 different
 functions, so I think I need to treat the list as a global variable.



 Firstly, I
 used the global assignment operator (“-“); secondly, I used “get” and 
 “assign”
 functions and even I used a new.env() in order to use a new environment
 exclusively for my list. However, when I try to build a package with all my
 functions I don’t reach this end, because of an error in parse process.



 My question
 for you is the following: taking into account that my end is to build a
 package, what can I do with this “global” list?. How can I treat it?.



 Thanks in
 advance.



 Regards,

 Eva




 [[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.




-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

__
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.