Page 1 of 2

Intergration R Markdown

Posted: Sun Feb 12, 2017 10:05 am
by ReinoutVrijhoef
Hello,

Thank you very much for designing this program. It is very user friendly, and uses the power of R. I'm learning R (and statistics) at the moment, and I'm trying to do everything in R Markdown. Is it possible to use the output generated bij Jamovi (or the jmv package, for that matter) in R Markdown? I can't really access the object in the manner that I'm used to, so including tables and figures, and referencing specific values is not really possible at the moment. I'm aware of the fact that copying and pasting in Word is an option, but that's not really science-proof, I think :-). Plus, not very dynamic, like the rest of the program.

Re: Intergration R Markdown

Posted: Sun Feb 12, 2017 11:11 am
by jonathon
hi reinout,

first up, i do apologise, our documentation in this area isn't excellent. you asking has prompted me to think through how we can improve the situation. i'll try and put some good docs up in the coming weeks. in the mean time, i've made you a little .Rmd doc which demonstrates the basics:

https://gist.githubusercontent.com/jona ... titled.Rmd

it's by no means complete, so do come back if you have further questions.

cheers

jonathon

Re: Intergration R Markdown

Posted: Fri Mar 24, 2017 1:56 pm
by rdotsch
Thanks, this is already very useful. It would be extremely handy to provide an interface to the tidy() function in the broom package (https://cran.r-project.org/web/packages ... broom.html). It would be a real game changer.

Cheers,

Ron

Re: Intergration R Markdown

Posted: Fri Mar 24, 2017 9:46 pm
by jonathon
ah! broom looks good!

i'll definitely take a closer look!

Re: Intergration R Markdown

Posted: Tue Mar 28, 2017 5:19 am
by jonathon
hey,

in the latest jmvcore 0.5.1 i've improved the situation substantially (inspired by broom)

you can now go: as.data.frame on results tables, and it will give you a data frame.

see the new gist here:

https://gist.github.com/jonathon-love/9 ... 05fee397a7

Re: Intergration R Markdown

Posted: Wed Mar 29, 2017 8:23 am
by rdotsch
Hi Jonathon,

This is awesome, thank you so much!

Ron

Re: Intergration R Markdown

Posted: Wed Apr 12, 2017 12:16 pm
by rdotsch
Hi Jonathon,

The approach outlined above works for main results tables. With repeated measures ANOVA it works for $rmTable. However, I get an error when trying to call as.data.frame() with $postHoc as argument to get to the post hoc tests table. This is the error that is returned:

Code: Select all

Error in as.data.frame.default(x[[i]], optional = TRUE) : 
  cannot coerce class "c("Array", "ResultsElement", "R6")" to a data.frame
I am using jmv 0.7.0.6 and jmvcore 0.5.1 on R 3.3.3.

Best,

Ron

Re: Intergration R Markdown

Posted: Wed Apr 12, 2017 12:25 pm
by jonathon
hi ron,

the post hoc object is an array of tables, so try going like this:

Code: Select all

as.data.frame(results$postHoc[[1]])
cheers

Re: Intergration R Markdown

Posted: Wed Apr 12, 2017 12:26 pm
by rdotsch
Hi Jonathon,

I see, thank you very much!

Best,

Ron

Re: Intergration R Markdown

Posted: Fri Apr 14, 2017 2:59 am
by jonathon
actually, i might make it a bit smarter, so when you go:

as.data.frame(results$postHoc)

it combines all the post hoc tables into a single data frame.

there's so many levels of refinement you can go to!