Page 1 of 1

contTable with stacked bar charts

Posted: Sat Apr 09, 2022 9:46 pm
by HilmiBro
Hi all!

I am teaching Jamovi in a Bachelor's seminar and I have my students reproduce their analysis in R.
I did that for the contTables (i.e., Chi-square) and encountered a problem, but I don't know if this is unique to my computer or a general issue:

This code should produce a a crosstab and it works in both Jamovi and R:

jmv::contTables(
formula = ~ var1:var2,
data = data,
odds = TRUE,
pcRow = TRUE)

This code should produce a stacked bar chart along with all other info:

jmv::contTables(
formula = ~ var1:var2,
data = data,
odds = TRUE,
pcRow = TRUE,
barplot = TRUE,
yaxis = "ypc",
yaxisPc = "row_pc",
bartype = "stack")

It does so in jamovi, but in R, it tells me:

Error in app$vspace(new_style$`margin-top` %||% 0) :
attempt to apply non-function

In some cases, one has to be specific about whether the variable is "numeric" or a "factor", but this did not solve the issue in that case.

Let me know, if you know a solution to that.
Thank you so much!

Hilmar

PS: Jamovi is amazing and you guys (Jonathon et al) did a great job!

Re: contTable with stacked bar charts

Posted: Mon Apr 11, 2022 1:39 am
by jonathon
hi,

i've just tried to run the following:

jmv::contTables(
formula = ~ dose:supp,
data = ToothGrowth,
odds = TRUE,
pcRow = TRUE,
barplot = TRUE,
yaxis = "ypc",
yaxisPc = "row_pc",
bartype = "stack")

and it didn't work, so i had to push a fix (it looks as though something might have changed in a recent version of R). it was giving me an error message different to what you describe, so i don't think it has fixed your issue, but you can at least try it:

remotes::install_github('jamovi/jmv')

if that is still an issue, can you provide us with a reproducible example? (ideally using some of the built in data sets in R, but BYO if you need to).

with thanks