I just realize this: For myVar1, I used colnames to name it firstly, and then convert myVar1 to numeric; However, I forgot to use rownames to name myVar2, instead I thought as.numeric(names(myVar2)) would work.
Now I name myVar2 using rownames first, as.numeric(names(myVar2)) is working. Thank you for pointing the mistake. -- View this message in context: http://r.789695.n4.nabble.com/names-function-not-working-at-the-2nd-place-in-a-program-tp4638004p4638122.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.