Peter Dalgaard wrote:
> Also, extending the above slightly:
>
Oups. Two lines fell out. I meant:
> y <- factor(c("b","c","b"))
> x <- factor(c("a","b","b"))
> d <- as.character(x)==as.character(y)
> table(d)
d
FALSE TRUE
2 1
> which(!d)
[1] 1 2
--
O__ Peter Dalgaard
|-Original Message-
> |From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> |Behalf Of Bernd Jagla
> |Sent: Friday, November 30, 2007 10:25 PM
> |To: r-help@r-project.org
> |Subject: [R] compare strings
> |
> |Sorry for the question, but I really cannot find the right
>From: Bernd Jagla <[EMAIL PROTECTED]>
>Date: 2007/11/30 Fri PM 09:24:34 CST
>To: r-help@r-project.org
>Subject: [R] compare strings
below assumes that there are only 2 columns in
the dataframe or that the string columns are the
first two columns ?
which(df[,1] == df[,2
sage-
|From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
|Behalf Of Bernd Jagla
|Sent: Friday, November 30, 2007 10:25 PM
|To: r-help@r-project.org
|Subject: [R] compare strings
|
|Sorry for the question, but I really cannot find the right search terms to
|find an answer..
|
|
|
|I have a data f
AIL PROTECTED] On
|Behalf Of Bernd Jagla
|Sent: Friday, November 30, 2007 10:25 PM
|To: r-help@r-project.org
|Subject: [R] compare strings
|
|Sorry for the question, but I really cannot find the right search terms to
|find an answer..
|
|
|
|I have a data frame with strings in some of the columns.
|
|I w
Sorry for the question, but I really cannot find the right search terms to
find an answer..
I have a data frame with strings in some of the columns.
I want to know all the rows where the strings in both columns are equal.
How do I do this?
Thanks,
Bernd
[[alternative HTML
6 matches
Mail list logo