Boyce, Morgan <morgan.boyce <at> bankofamerica.com> writes: >
> y.JIBqq[,1][y.JIBqq[,1]> y.JIBqq[,2]]<-'up move' > y.JIBqq[,1][y.JIBqq[,1]< y.JIBqq[,2]]<-'down move' Your first command above makes y.JIBqq[,1] into a character vector (rather than numeric), which then makes the subsequent comparison complicated/tricky (it will be a lexical, rather than a numeric one -- for example, consider the fact that "-0.01">"0.001" is TRUE) A better way to do what you want is probably something like ## read in data x <- read.table("miscdate.txt", colClasses=c("Date","numeric","numeric")) rownames(x) <- as.character(x[,1]) x <- x[,-1] ## at this point I have something like your y.JIBqq move <- ifelse(x[,1]>x[,2],'up move','down move') x <- data.frame(x,move) ______________________________________________ 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.