Sri krishna Devarayalu Balanagu
2012-Aug-17 09:48 UTC
[R] How can we compare corresponding values of x and y (first value of x exacly matches with the first value of y)?
df <- data.frame ( "RowId" = 4:7, "x"=c("1_1", "2_2", "3_3", "3_3"), "y"=c("1_1", "3_3", "2_2", "3_3") ) How can we compare corresponding values of x and y (first value of x exacly matches with the first value of y)? If they were not matced exactly how can we get the row id? In this case the row ids were 5 and 6. ________________________________ Notice: The information contained in this electronic mail message is intended only for the use of the designated recipient. This message is privileged and confidential. and the property of GVK BIO or its affiliates and subsidiaries. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by telephone +91-40-66929999<tel:%2B91-40-66929999> and destroy any and all copies of this message in your possession (whether hard copies or electronically stored copies). [[alternative HTML version deleted]]
Jim Lemon
2012-Aug-17 10:25 UTC
[R] How can we compare corresponding values of x and y (first value of x exacly matches with the first value of y)?
On 08/17/2012 07:48 PM, Sri krishna Devarayalu Balanagu wrote:> df<- data.frame ( > "RowId" = 4:7, > "x"=c("1_1", "2_2", "3_3", "3_3"), > "y"=c("1_1", "3_3", "2_2", "3_3") > ) > > How can we compare corresponding values of x and y (first value of x exacly matches with the first value of y)? > If they were not matced exactly how can we get the row id? > In this case the row ids were 5 and 6. >Hi Sri krishna Devarayalu Balanagu, how about this: df$RowId[which(df$x != df$y)] Jim
Rui Barradas
2012-Aug-17 11:12 UTC
[R] How can we compare corresponding values of x and y (first value of x exacly matches with the first value of y)?
Hello, I've changed the name of the data.frame, df is an R function. DF$RowId[ DF$x != DF$y ] Hope this helps, Rui Barradas Em 17-08-2012 10:48, Sri krishna Devarayalu Balanagu escreveu:> df <- data.frame ( > "RowId" = 4:7, > "x"=c("1_1", "2_2", "3_3", "3_3"), > "y"=c("1_1", "3_3", "2_2", "3_3") > ) > > How can we compare corresponding values of x and y (first value of x exacly matches with the first value of y)? > If they were not matced exactly how can we get the row id? > In this case the row ids were 5 and 6. > > > ________________________________ > Notice: The information contained in this electronic mail message is intended only for the use of the designated recipient. This message is privileged and confidential. and the property of GVK BIO or its affiliates and subsidiaries. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by telephone +91-40-66929999<tel:%2B91-40-66929999> and destroy any and all copies of this message in your possession (whether hard copies or electronically stored copies). > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.