liamrevell / phytools

GNU General Public License v3.0
207 stars 56 forks source link

Error in `[<-`(`*tmp*`, x == seq[i], i, value = 1) : subscript out of bounds #77

Closed ymilesz closed 3 years ago

ymilesz commented 4 years ago

Hi Liam,

I am trying to do ASR with discrete data, and I've gotten this error Error in [<-(*tmp*, x == seq[i], i, value = 1) : subscript out of bounds using both my own data as well as the data from this Exercise: http://www.phytools.org/Cordoba2017/ex/8/Anc-states-discrete.html

I've used this code before so I know it worked before, I'm using R4.0.2

Thanks,

Miles

bheimbu commented 3 years ago

Hi Liam,

I have the same problem. Any help is highly appreciated.

Cheers Bastian

liamrevell commented 3 years ago

Maybe try converting your discrete character to a factor and then re-run. How text was interpreted by default in R changed between R<4.0 and R>4.0. Let me know if that does anything.

bheimbu commented 3 years ago

Hi Liam,

you made my day, again. Many thanks. I have used the as.factor() function and it worked perfectly.

Cheers Bastian