Re: [R] Equality of factor levels problem

2016-01-05 Thread Martín Cañón
Thank you, Sarah. This works just fine. So simple. I didn't know I had to change the factor to character before making the comparison. Regards, Mart�n [[alternative HTML version deleted]] __ R-

Re: [R] Equality of factor levels problem

2016-01-05 Thread Sarah Goslee
You want to compare the values of the levels, I think? What about: > as.character(dat$var1) == as.character(dat$var2) [1] TRUE FALSE TRUE FALSE FALSE Sarah On Tue, Jan 5, 2016 at 10:58 AM, Martín Cañón wrote: > Hi to all useRs on the list. > > I want to know if there is a function in R which

[R] Equality of factor levels problem

2016-01-05 Thread Martín Cañón
Hi to all useRs on the list. I want to know if there is a function in R which evaluates if observations of two factors (similar but with unequal levels) in a data frame are equal at row level. Example of dataset: var1 <- c(1, 2, 3, 2, 1) var2 <- c(1, 3, 3, 4, 2) dat <- data.frame(var1, var2) d