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 <dwinsemius@comcast.net>wrote:

>
> 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, var=y)
> >    return(val)
> > }
> >
> > metropolis <- function(t, c, x, y){
> >    den1 <- unnormalized(t, mean=x, sd=y)
> >    den2 <- unnormalized(c, mean=x, sd=y)
> >    if(den1 < den2)
> >       return(a)
> >    else
> >       return(b)
> > }
> >
> > for(i in 1: 100){
> >    matrix <- c()
> >    matrix[i] <- metroplis(1, 2, 3, 4)
> > }
> > Here, I reused letter "t" and "c", and the word "matrix".  Could this
> cause
> > any potential problems?
>
>  Whatever problems you are having at the moment (and they appear to be
> many) are not  due to using existing function names as data-object names.
> You are asked to report the error messages you get with your code problems,
> and those messages I found to be reasonably informative for the first 5
> errors I found.
>
> --
> David Winsemius
> Alameda, CA, USA
>
>

	[[alternative HTML version deleted]]

