Re: [R] Does it exist a function for this?
On 10/05/2011 07:42 PM, lunarossa wrote: I have this kind of matrix, with thousands of cases. A 2 apple A 2 peach A 3 peach B 1 pear B 4 peach B 4 beef B 7 beef C 1 peach D 2 apple D 5 peach I have to distinguish, from the other rows, the rows with peach and this is not a problem. I also have to discriminate the rows with peach like the second one (associated with the same two cells A and 2 to apple, see first row) from the row like the 3rd or the 8th ones, when the first two cells are unique (A and 3 or C and 1). Hi lunarossa, I may be on the wrong track, but you could just stick the three components together: alphanumfruit[,4]-paste(alphanumfruit[,1], alphanumfruit[,2],alphanumfruit[,3],sep=) and the fourth column of your object (which I suspect is a data frame) will have elements that can be tested for matching or non-matching. More complicated conditions can be accommodated by pasting different combinations of the columns together. Jim __ 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.
[R] Does it exist a function for this?
I have this kind of matrix, with thousands of cases. A 2 apple A 2 peach A 3 peach B 1 pear B 4 peach B 4 beef B 7 beef C 1 peach D 2 apple D 5 peach I have to distinguish, from the other rows, the rows with peach and this is not a problem. I also have to discriminate the rows with peach like the second one (associated with the same two cells A and 2 to apple, see first row) from the row like the 3rd or the 8th ones, when the first two cells are unique (A and 3 or C and 1). -- View this message in context: http://r.789695.n4.nabble.com/Does-it-exist-a-function-for-this-tp3873827p3873827.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.
Re: [R] Does it exist a function for this?
Hi, I am not sure I understand your question. Are you asking how to find the rows that satisfies the condition of the second row? Something like: (let's say the data.frame is called X) X[,1] == A X[,2] == 2 X[,3] == peach ? Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- On Wed, Oct 5, 2011 at 10:42 AM, lunarossa gloriaal...@yahoo.it wrote: I have this kind of matrix, with thousands of cases. A 2 apple A 2 peach A 3 peach B 1 pear B 4 peach B 4 beef B 7 beef C 1 peach D 2 apple D 5 peach I have to distinguish, from the other rows, the rows with peach and this is not a problem. I also have to discriminate the rows with peach like the second one (associated with the same two cells A and 2 to apple, see first row) from the row like the 3rd or the 8th ones, when the first two cells are unique (A and 3 or C and 1). -- View this message in context: http://r.789695.n4.nabble.com/Does-it-exist-a-function-for-this-tp3873827p3873827.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. [[alternative HTML version deleted]] __ 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.