# Setting up a stacked dataframe for multilevel model analysis in R

I need to set up my data frame into a stacked or long form in order to do a random crossed effects multilevel analysis.

My random factors are participants and items (words in the assessment) My fixed factors are the item characteristics e.g. word length, neighbourhood frequency and neighbourhood density. As well as the participants response times.

Each participant saw the same 20 words under the same conditions. My aim is to test for a difference in response time based on the word characteristics mentioned above.

I have a few questions I was hoping someone could help me with:

1. I know that I need a random crossed effects multilevel analysis, but I have no idea how to stack the data frame so that I can run this analysis. Looking for code to do this in R. This is sort of what I need it to look like (I think):

1. I am unsure if I need to first factor my word characteristics into groups (E.g. high density, low density, high frequency, low frequency etc.) Or if I can use the raw scores for this and keep them as continuous factors?

2. Can I then use the lme4 package to run the multilevel analysis to answer my question "is there a difference in response times for different word characteristics"?

Would really appreciate the help as I am very new to R and multilevel modelling.

• Could you please edit your question to show your data example directly as text, formatted with the code {} tool on the toolbar or as a table? It's very hard to read the values on the image you provide, and those who use text-to-speech software won't be able to "see" the values at all.
– EdM
May 14 at 17:35