Accessing output from the jmv( ) package
Posted: Sat Mar 19, 2022 8:49 am
I've started developing some teaching materials, using Jamovi as a (rather brilliant) teaching tool to scaffold students as they start to learn the basics of R. Enabling syntax in Jamovi, copying and pasting and running it with the jmv() package seems like a fantastic way to go.
But I've hit a snag. I want to be able to show student how to format their output tables, e.g. using kableExtra or similar packages. I figured I'd need to do a lot of experimentation to get this working, but I'm stuck at the first hurdle.
When I run most base R functions, or indeed functions from other packages, I generally get a dataframe or list saved to the local environment. So if I run this...
I can access various bits of the output like this
I can inspect the object I've saved the output to, over in the Data part of the Environment inspector, and figure out which bits I need.
When I use the jmv() package, e.g.
I instead get an object saved as a single value with <Object containing active binding> against it.
How do I go about accessing tables and values, please? Is there a way to assign the output to an object in a similar way to how it works with base R functions etc?
(I'm hoping I've made that clear, but I'm not certain, so please do let me know if you need more detail.)
But I've hit a snag. I want to be able to show student how to format their output tables, e.g. using kableExtra or similar packages. I figured I'd need to do a lot of experimentation to get this working, but I'm stuck at the first hurdle.
When I run most base R functions, or indeed functions from other packages, I generally get a dataframe or list saved to the local environment. So if I run this...
Code: Select all
lm_output <- lm(Sepal.Width ~ Petal.Width, iris)
Code: Select all
lm_output$coefficients
When I use the jmv() package, e.g.
Code: Select all
library(jmv)
corr_output <- corrMatrix(iris, vars=vars(Sepal.Width, Petal.Length, Petal.Width),
pearson = TRUE, sig = TRUE, flag = TRUE, n = TRUE, hypothesis = "corr")
How do I go about accessing tables and values, please? Is there a way to assign the output to an object in a similar way to how it works with base R functions etc?
(I'm hoping I've made that clear, but I'm not certain, so please do let me know if you need more detail.)