Intergration R Markdown

Discuss the jamovi platform, possible improvements, etc.
ReinoutVrijhoef
Posts: 3
Joined: Sat Feb 11, 2017 5:06 pm

Intergration R Markdown

Post 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.
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: Intergration R Markdown

Post 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
rdotsch
Posts: 5
Joined: Fri Mar 24, 2017 1:53 pm

Re: Intergration R Markdown

Post 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
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: Intergration R Markdown

Post by jonathon »

ah! broom looks good!

i'll definitely take a closer look!
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: Intergration R Markdown

Post 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
rdotsch
Posts: 5
Joined: Fri Mar 24, 2017 1:53 pm

Re: Intergration R Markdown

Post by rdotsch »

Hi Jonathon,

This is awesome, thank you so much!

Ron
rdotsch
Posts: 5
Joined: Fri Mar 24, 2017 1:53 pm

Re: Intergration R Markdown

Post 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
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: Intergration R Markdown

Post 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
rdotsch
Posts: 5
Joined: Fri Mar 24, 2017 1:53 pm

Re: Intergration R Markdown

Post by rdotsch »

Hi Jonathon,

I see, thank you very much!

Best,

Ron
User avatar
jonathon
Posts: 2613
Joined: Fri Jan 27, 2017 10:04 am

Re: Intergration R Markdown

Post 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!
Post Reply