Hi Bill,
On 05/29/2015 01:48 PM, William Dunlap wrote:
I'm not sure why which particular ID gets assigned to each string would
matter but maybe I'm missing something. What really matters is that each
string receives a unique ID. match(x, x) does that.
I think each row of the OP's dataset repre
>I'm not sure why which particular ID gets assigned to each string would
>matter but maybe I'm missing something. What really matters is that each
>string receives a unique ID. match(x, x) does that.
I think each row of the OP's dataset represented an individual (column 2)
followed by its mother a
Hi Sarah,
On 05/29/2015 12:04 PM, Sarah Goslee wrote:
On Fri, May 29, 2015 at 2:16 PM, Hervé Pagès wrote:
Hi Kate,
I found that matching the character vector to itself is a very
effective way to do this:
x <- c("a", "bunch", "of", "strings", "whose", "exact", "content",
"is", "o
On Fri, May 29, 2015 at 2:16 PM, Hervé Pagès wrote:
> Hi Kate,
>
> I found that matching the character vector to itself is a very
> effective way to do this:
>
> x <- c("a", "bunch", "of", "strings", "whose", "exact", "content",
> "is", "of", "little", "interest")
> ids <- match(x, x)
I found this helpful. However - the second to forth columns come out
all zero - was this the intention?
That is:
X0001 0 0 0 2 1 BYX859
X0001 0 0 0 1 1 BYX894
X0001 0 0 0 2 2 BYX862
X0001 0 0 0 2 2 BYX863
X0001 0 0 0 2 2 BYX864
X0001 0 0 0 2 2 BYX865
On Fri, May 29, 2015 at 1:31 PM,
Hi Kate,
I found that matching the character vector to itself is a very
effective way to do this:
x <- c("a", "bunch", "of", "strings", "whose", "exact", "content",
"is", "of", "little", "interest")
ids <- match(x, x)
ids
# [1] 1 2 3 4 5 6 7 8 3 10 11
By using this tri
match() will do what you want. E.g., run your data through
the following function.
f <- function (data)
{
uniqStrings <- unique(c(data[, 2], data[, 3], data[, 4]))
uniqStrings <- setdiff(uniqStrings, "0")
for (j in 2:4) {
data[[j]] <- match(data[[j]], uniqStrings, nomatch = 0L
Of course, but I would not recommend it. A factor is a vector of integers with
an attribute containing the labels that those integers correspond to. You seem
to be asking for a factor that has lost the definitions part. But hey,
newvector <- as.integer(factor(oldvector)) should get you what you
Here is an example to get you started:
mycol <- c('b','a','d','d','b','c')
as.numeric(factor(mycol))
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 5/29/15, 9:58 AM, "Kate Ignatius" wrote:
>I have a pedigree file as
9 matches
Mail list logo