Unable to use phangorn::phyDat I am following an example from ‘Analysis of Phylogenetics Second Edition and Evolution with R’ from Emmanuel Paradis.
He is doing:

I am doing pretty much the same:
x=c('garras','garras','garras', 'tejido','tejido','tejido')
y &lt;- phyDat(matrix(x), &quot;USER&quot;, levels = unique(x))

but I get:

Error in phyDat.default(data, levels = levels, return.index =
return.index, : data object must contain taxa names

Screenshot:

What am I doing wrong? how come the example from the book works...
I cannot access the book, it might be an older version or there are some steps in between. The screen shot doesn't help.
If you look at the vignette and the error, what you need to provide is a matrix of characters with defined row names, for example:
set.seed(111)
x = sample(letters,100,replace=TRUE)
phyDat(matrix(x),&quot;USER&quot;,levels=unique(x))

Error in phyDat.default(data, levels = levels, return.index = return.index,  : 
  data object must contain taxa names

mat = matrix(x,10,10,dimnames=list(paste0(&quot;t&quot;,1:10),NULL))
phyDat(mat,&quot;USER&quot;,levels=unique(x))
10 sequences with 10 character and 10 different site patterns.
The states are n t s o y e c h z q m j d o h n z y x p q g u o a i h y c g t d f y t d f e u e f d i j r z x w u m a j p j g d t q y v o x p m s o z x z a y j z r u s a y k l f g l f r i l r f m t t e f x v f g q j