Intergration R Markdown

Discuss the jamovi platform, possible improvements, etc.

by ReinoutVrijhoef » Sun Feb 12, 2017 10:05 am

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.
ReinoutVrijhoef
 
Posts: 3
Joined: Sat Feb 11, 2017 5:06 pm

by jonathon » Sun Feb 12, 2017 11:11 am

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

by rdotsch » Fri Mar 24, 2017 1:56 pm

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/vignettes/broom.html). It would be a real game changer.

Cheers,

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

by jonathon » Fri Mar 24, 2017 9:46 pm

ah! broom looks good!

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

by jonathon » Tue Mar 28, 2017 5:19 am

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

by rdotsch » Wed Mar 29, 2017 8:23 am

Hi Jonathon,

This is awesome, thank you so much!

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

by rdotsch » Wed Apr 12, 2017 12:16 pm

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

by jonathon » Wed Apr 12, 2017 12:25 pm

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

by rdotsch » Wed Apr 12, 2017 12:26 pm

Hi Jonathon,

I see, thank you very much!

Best,

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

by jonathon » Fri Apr 14, 2017 2:59 am

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

Next

Return to General