kenkellner / jagsUI

R package to Run JAGS (Just Another Gibbs Sampler) analyses from within R
https://kenkellner.github.io/jagsUI/
35 stars 7 forks source link

jagsUI masks View : causing issues with Rstudio dataviewer #24

Closed OliverFishCode closed 5 years ago

OliverFishCode commented 5 years ago

This issue was mention in Issue #13. This is still very annoying. Is there a workaround or can you implement a solution?

kenkellner commented 5 years ago

You can save Rstudio's custom View() implementation to a new name before you load jagsUI

rstudio_view <- View
library(jagsUI)
View(iris)
rstudio_view(iris)

I'm still not convinced this isn't mainly an Rstudio problem, since Rstudio is silently overwriting utils::View with its own function when you launch R from the IDE.

It seems like you can detect if you are in an RStudio environment with

Sys.getenv("RSTUDIO")

so maybe this could be handled automatically by jagsUI. Changing package functions to handle specific IDEs isn't ideal though and there's no guarantee that check will work long-term.

OliverFishCode commented 5 years ago

This should work. Additionally, I understand that changing package functions for a bunch of specific IDE's would be a pain. However, Rstudio I would consider the exception, as it is the most commonly used IDE for R.

kenkellner commented 5 years ago

I plan to replace the View method approach with a standalone function in the next version of the package, see 275108c. For now (in 1.5.1) it gives a warning that View is deprecated.