1
$\begingroup$

I am using seqecreate to specify an event sequence object using TraMineR.

The dataset has 1271 rows and 4 columns, an id, timestamp (timed), and 2 event variables (one numeric and one string). Most of the data have only 1 event per id. I've done other analyses with these data in SAS without issues. When I run seqecreate the procedure stops at id 425 with an error message:

> etv.ev <- seqecreate(id=etvev$id, timestamp=etvev$timed, event=etvev$event2, use.labels=FALSE)

Warning message:

In seqecreate.internal(data = data, id = id, timestamp = timestamp,  :
  NAs introduced by coercion

The offending data in this part of the dataframe look ok (row 535 is the last before the error):

row     id       event2 timed event1
534 2144155702   xETV     0      1
535 2149998801   xETV     0      1
536 2150098301   xETV     0      1
537 2150098301   ETV2    27      2
538 2152463101   xETV     0      1

This error occurs with both event variables. I'd like to understand the problem and how to fix it.

$\endgroup$

1 Answer 1

5
$\begingroup$

Playing around with your data, I found the problem is with the id column. The error occurs when the id exceeds some value. This is a bug in seqecreate.

A workaround is to pass your ids as a factor:

seqecreate(id=factor(etvev$id), timestamp=etvev$timed, event=etvev$event2)

Hope this helps.

$\endgroup$
1
  • 1
    $\begingroup$ And a perfect example of how posting your data really, really helps get good answers! $\endgroup$
    – Wayne
    Commented Mar 29, 2013 at 18:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.