lmertree: Partitioning factor with too many levels? I am new to lmertrees. I am having trouble analyzing how individual stimuli in my data clusters together on the basis of how some participants answered to them in three different conditions. My code throws the following error:
Warning in matrix(0, nrow = mi, ncol = nl) :
  NAs introduced by coercion to integer range
Error in matrix(0, nrow = mi, ncol = nl) : 
  invalid 'nrow' value (too large or NA)

I think it is suggesting that my partitioning variable (the stimuli) has too many levels for the lmertree to handle. It has 37 levels. This is the formula of my lmertree:
dataF.mTree <- lmertree(Response ~ Condition * Country + Trial.Order
                            | (1 + Condition | Participant.ID) + (1 + Condition | Stimuli.ID)
                            | Stimuli.ID,
                            data = dataF)

And this is the structure of my data:
Participant.ID  Country      Trial.Order  Event.ID  Condition   Response
P01             Spain        1            E01       Zero           12
P01             Spain        2            E02       Partial        67
P01             Spain        3            E03       Full           85
P02             England      3            E01       Partial        45
P02             England      2            E02       Full           69
P02             England      1            E03       Zero            0
P03             Netherlands  2            E01       Full          100
P03             Netherlands  1            E02       Zero            6
P03             Netherlands  3            E03       Partial        30

I read in the internet that some clustering packages in r can handle more partitioning levels than others. Is this right? In those posts people suggested to reduce the number of levels by combining them to form a smaller set of levels, but in my case it is not possible. I truly need to analyze which items cluster together depending on the responses that people gave. Any ideas?

For splitting a categorical variable with $k$ levels into 2 groups, there are $2^{k-1} - 1$ possibilities.
In classical regression trees with constant fits in the nodes, you do not need to consider all of these explicitly. It is sufficient to order the $k$ levels by the mean of the response and then search $k$ possible splits.
For the case with more complex linear models in the nodes I'm not aware of such a shortcut. Hence, lmtree() and based on that lmertree() explicitly has to try out all $2^{k-1} - 1$ possibilities which is computationally infeasible.
Therefore, one possibility to avoid searching like this (as you mention in your question) is to characterize the categorical variable by various other variables in which searching for possible splits is feasible.
