# R code for multilevel latent class model

#### cri_came

##### New Member
Dear all,

I am not able to find a reliable r code to run a multilevel latent class model. Indeed, I have to analyze how social trust (three variable form the ESS survey) might vary between countries (21 countries in my database). I tried to use the poLCA package but I am not sure if my code is right. This is my code:
lca <- cbind(ppltrst+1,pplfair+1,pplhlp+1)~cntry
lc <- poLCA(lca,mydata)

However, I get an error message:
Error in [.data.frame(data, , match(colnames(y), colnames(data))[j]) :
undefined columns selected

How can I solve this? Is the code completely wrong or I missed some passages?
Thank you very much for your help!

Cristina

#### lilchaos

##### New Member
I dont know your package but what data do you need to put into lca? for me it seems like a problem with cbind.
if you want a dataframe try data.frame(x,y,z)