I am relatively new to R and trying to carry out a conjoint experiment using the cjoint package in R to figure out the characteristics favored by voters in choosing a political candidate. I have been able to carry out the 'amce' regression as well as the plots that the regression produces. The code for the 'amce' regression looks like this:
results_overall <- amce(chosen ~ gender + residence + party + partisanship + education + copartisan + profession_type + caste_type + pol_connection, data=cdata_chosen, cluster=TRUE, respondent.id= "serial_id", design="uniform")
The code for the plot is:
candidate_plot <- plot(results_overall, main="Overall Candidate Preference", xlab="Change in E[Y]", text.size=8, point.size = 0.3, dodge.size = 0.9)
And the produced plot is: Conjoint Experiment Plot:
Now I am trying to produce multiple plots on the same page, where the y-axis remains constant and the new plots are conditional on the specific characteristics of respondents. So, for example, a plot of how the preferences for characteristics of political candidates differ between rich and poor voters produced on the same page rather than two different plots. I have tried to facet_grid and facet_wrap, but they don't seem to be working with this plot. I keep getting the error:
candidate_plot + facet_grid(. ~ econ_class) Error in candidate_plot + facet_grid(. ~ econ_class) : non-numeric argument to binary operator
Does anyone know how to get rid of this error or create facet plots using a different technique that caters to the plots produced by the cjoint package?