search for: percentdistance

Displaying 1 result from an estimated 1 matches for "percentdistance".

2007 Sep 19
2
function on factors - how best to proceed
...t of these columns are factors. Now, I have a function that I would like to employ on this data frame. Right now I cannot get it to work, and that seems to be due to the columns in the data frame being factors. I tested it with a data frame created from vectors, and it worked fine. The function: percentdistance <- function(origin, terminus, length, begin, replicor){ print(c(origin, terminus, length, begin, repl)) d = 0 if (terminus>origin) { if(replicor=="LEFT") { d = -((origin-begin)%%length) } else { d = (begin-origin) } } else { if (replicor=="LEFT") { d=(o...