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

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 3/1/13 1:56 PM, "C W" <tmrs...@gmail.com> 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?

Thanks in advance,
Mike

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

Reply via email to