Re: [R] using reserved words in R, and reuse variable names in different functions

2013-03-04 Thread MacQueen, Don
Yes, it can cause problems. And speaking for myself, I'd say it's not worth the risk, because it's easy enough to find alternative variable names that are close enough to the notation of your formulas that remembering should be no problem. For example, tt, cc, and mmatrix might do it. -Don --

Re: [R] using reserved words in R, and reuse variable names in different functions

2013-03-02 Thread Duncan Murdoch
in R, and reuse variable names in different functions On 03/02/2013 01:12 PM, Sarah Goslee wrote: On Fri, Mar 1, 2013 at 7:06 PM, C W tmrs...@gmail.com wrote: Thanks, that was just an example I came up with. I was just curious if using same variable names in different functions would cause

Re: [R] using reserved words in R, and reuse variable names in different functions

2013-03-02 Thread Peter Ehlers
Duncan's comment may not qualify as a fortune, but it did make me chuckle. Peter Ehlers On 2013-03-02 03:01, Duncan Murdoch wrote: On 13-03-01 8:35 PM, C W wrote: [...snip...] pie is a function, but all it does is draw pie charts, so who cares if you mask it? :-). Duncan Murdoch

Re: [R] using reserved words in R, and reuse variable names in different functions

2013-03-02 Thread Rolf Turner
Well *I* think it should be a fortune! cheers, Rolf On 03/03/2013 10:30 AM, Peter Ehlers wrote: Duncan's comment may not qualify as a fortune, but it did make me chuckle. Peter Ehlers On 2013-03-02 03:01, Duncan Murdoch wrote: On 13-03-01 8:35 PM, C W wrote: [...snip...]

[R] using reserved words in R, and reuse variable names in different functions

2013-03-01 Thread C W
Hi list, I am writing several functions and running out variable names. I am using words such as t, c, matrix to keep the notation same as formulas I am using. For example I have, unnormalized - function(t, x, y){ val - rnorm(t, mean=x, var=y) return(val) } metropolis - function(t, c,

Re: [R] using reserved words in R, and reuse variable names in different functions

2013-03-01 Thread David Winsemius
On Mar 1, 2013, at 1:56 PM, C W wrote: Hi list, I am writing several functions and running out variable names. I am using words such as t, c, matrix to keep the notation same as formulas I am using. For example I have, unnormalized - function(t, x, y){ val - rnorm(t, mean=x,

Re: [R] using reserved words in R, and reuse variable names in different functions

2013-03-01 Thread C W
Thanks, that was just an example I came up with. I was just curious if using same variable names in different functions would cause problems. Especially with reserved words. Mike On Fri, Mar 1, 2013 at 5:45 PM, David Winsemius dwinsem...@comcast.netwrote: On Mar 1, 2013, at 1:56 PM, C W

Re: [R] using reserved words in R, and reuse variable names in different functions

2013-03-01 Thread Sarah Goslee
On Fri, Mar 1, 2013 at 7:06 PM, C W tmrs...@gmail.com wrote: Thanks, that was just an example I came up with. I was just curious if using same variable names in different functions would cause problems. No. The environment of a function is independent of other functions. Especially with

Re: [R] using reserved words in R, and reuse variable names in different functions

2013-03-01 Thread Rolf Turner
On 03/02/2013 01:12 PM, Sarah Goslee wrote: On Fri, Mar 1, 2013 at 7:06 PM, C W tmrs...@gmail.com wrote: Thanks, that was just an example I came up with. I was just curious if using same variable names in different functions would cause problems. No. The environment of a function is

Re: [R] using reserved words in R, and reuse variable names in different functions

2013-03-01 Thread William Dunlap
] On Behalf Of Rolf Turner Sent: Saturday, March 02, 2013 5:01 AM To: Sarah Goslee Cc: r-help Subject: Re: [R] using reserved words in R, and reuse variable names in different functions On 03/02/2013 01:12 PM, Sarah Goslee wrote: On Fri, Mar 1, 2013 at 7:06 PM, C W tmrs...@gmail.com wrote

Re: [R] using reserved words in R, and reuse variable names in different functions

2013-03-01 Thread C W
-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Rolf Turner Sent: Saturday, March 02, 2013 5:01 AM To: Sarah Goslee Cc: r-help Subject: Re: [R] using reserved words in R, and reuse variable names in different functions On 03/02/2013 01:12 PM, Sarah