Difficulty calling R2OpenBUGS - r

I am having a problem calling R2OpenBUGS.
I suspect it is probably simple to fix but I can't spot the solution.
My call looks like this:
MCMCres<-bugs(data=d,inits=inits,parameters.to.save=c("theta","alpha","tau","precv"),
n.iter=2000,model.file="model.txt",n.chains=2,n.burnin=250,n.thin=5,
OpenBUGS.pgm=BugsDir,codaPkg=F,working.directory=wdir,debug=T,WINE=NULL)
The error I get back is as follows:
Error in bugs.run(n.burnin, OpenBUGS.pgm, debug = debug, WINE = WINE, :
Look at the log file in C:/Users/James/Desktop/ALS Spatial Analysis/ALS and
try again with 'debug=TRUE' to figure out what went wrong within OpenBUGS.
Now OpenBUGS isn't even opening so the log file is not written. I'm not sure whats going on since this is all I have to go on. It is finding the OpenBUGS executable and it is finding the model file as those were errors I had gotten previously and have fixed.
Any ideas anyone ?

Related

Getting an error when intry to load a dataframe

Getting a syntax error and not sure why. Trying to loadca dataframe. Please can someone help. Thanks
If you are getting started with programming, jupyter can be counter intuitive at some points, I assume that's not your first cell in the notebook, so be sure to run the previous ones where the definition for titanic_df/titanic_csv is loaded.
The error you are getting says NameError, not SyntaxError, and it is informing you that a variable called titanic_csv does not exist.

OpenAI Gym - Env.Render() function returning "Display surface quit"

A screenshot of my code with error
I am following the tutorial seen at https://www.youtube.com/watch?v=7SVv07QXO5M&ab_channel=HackersRealm
The exact code I am following is here: https://github.com/aswintechguy/Reinforcement-Learning-Projects/blob/main/Cartpole%20Balance%20-%20OpenAI%20Gym%20-%20Reinforcement%20Learning/CartPole%20Balance%20-%20OpenAI%20Gym%20-%20Reinforcement%20Learning.ipynb
Not sure what I am doing wrong but the guy doing the tutorial had no issues so I'm not sure how to troubleshoot this. I'm also doing this in a Jupyter Notebook. Any ideas what I might be doing wrong here?
I have seen similar error, in my case i got this error when i ran the env.close() and tried running again, i'm suspecting, this was the reason for my error, because once env.close() has been called there is no environment to perform rest of the operations so I had to re-run the cell to create the environment to try it again. Im assuming this may have been your case.
Try running the cell with make environment and retry the cell which throws u the error.

I can't find anything pertaining to this particular error message

So I keep getting an error message in R when I try to use the bias function here's what my code looks like so far:
install.packages("SimDesign")
library(SimDesign)
actual_temp<-c(68.3,70,72.4,71,67,70)
predicted_temp<-c(67.9,69,71,5,70,67,69)
bias(actual_temp, predicted_temp)
And here's the error message I get when I run the code:
Error in bias(actual_temp, predicted_temp) :
ncol(estimate) == length(parameter) is not TRUE
I've tried figuring out if my syntax is off (I'm a novice so I'm never 100% sure). I then tried copy-pasting the error into the search bar and came up with nothing. If anyone has an idea of how to fix this that would be great in case it's a problem I run into again in the future.
Edit: I tried again with some different data and it worked just fine. Is there something in this specific instance you can identify that's making it not work?

How do I get pretty error messages in RStudio?

When working in RStudio (version 0.99.482 and 1.0.136), if I source a file and an error occur I just get the error message without any context. If the file is longer than a few lines of code, that informaiton is largely useless. What I want to know when an error occurs is the following:
What function threw the error? Preferably what function I called from my script, not something burried deep inside a package.
On what line of my file did the error occur?
This seems like a very basic thing for a scripting language to do, but yet I am unable to find an easy solution. Yes, I am aware of the traceback() function, but (a) it is a hassle to call it every time there is an error, and (b) the output is massive and not that helpful.

Slow or stacking file.choose() in R

If I have more data loaded in R I'm having difficulties with opening and choosing new file via file.choose() and later upload via read.csv(), but I would not get to that point since the file.choose function stacks and the R "crushes" and reports something like "unidentified error occurred and that the R must restart".
I'm using RStudio and running this on Windows 7. The hardware is up to date.
Could someone point me on why this is happing and what would be a remedy against this. Are there other options to select file? I know I can insert the path right into the read.csv command, but the (file is different every time).
EDIT:
The error just happened again. I can not reproduce the error so it happens rather only with high likelihood if the conditions for it are met.
The error reads as: R Session Aborted.R encountered fatal error. The session was terminated. And in window: "Start New Session".
EDIT 2:
I would just rephrase my question. The question is whether there is other option like command or package that deals with choosing a file. [file.choose()]
The error can not be reproduced and hence I can not expect someone gives reasonable comment on this. But if this occurred someone in the past and solved it, I would like to hear about it. Thanks.
EDIT 3: Further to the error. I have spotted just now sentence in red in Console: Error: Unable to provide connection with R

Resources