Page 1 of 1

Running occMod crashes my R session

PostPosted: Wed Oct 17, 2018 12:27 pm
by ksl59
Hi everyone, I'm new here. Glad to have a place to air my question.

I'm trying to use the most recent version of RPresence on R 3.5.1 via RStudio 1.1.456, on a MacBook Pro running High Sierra. I successfully installed RPresence and created a properly formatted PAO file from point count data. However, when I tried to build my first model using the following code, my R session "encountered a fatal error" and crashed.

hhOcc <- data.frame(matrix(as.numeric(unlist(hhDataL[,2:6])),nrow = 115,ncol = 5))
hhPao <- createPao(hhOcc,title = "HH Occupancy",unitnames = ptL)
psidotpsurvey <- occMod(model=list(psi~1,p~SURVEY),data = hhPao,type = "so")

No error code, nothing to debug. I've also tried R 3.3.3 and rolling back RStudio, with the same problem. Any thoughts?

Yours,
Katherine

Update: I've tried running the example provided in the info file of occMod, and that successfully runs. So clearly something is wrong with my PAO file. My creation process went smoothly, and the input data is a simple 115 sample unit by 5 occasions data frame of ones, zeros, and NAs, so what might be wrong?

Re: Running occMod crashes my R session

PostPosted: Wed Oct 17, 2018 7:27 pm
by jhines
Hi Katherine,

I can't think of a reason for it not to work. Would you mind sending me your input file and R script?

Jim (jhines@usgs.gov)

Re: Running occMod crashes my R session

PostPosted: Wed Oct 17, 2018 9:09 pm
by ksl59
Hi Jim,

Thanks for your quick reply! I just send you an email with a snippet that reproduces the problem and my input file.

Katherine

Re: Running occMod crashes my R session

PostPosted: Wed Oct 17, 2018 11:12 pm
by ksl59
Further update:

I realized that I ran the example from occMod() in the console of RStudio- I did not script it- and then I just tried running my own code in the console, and the R session didn't crash. So, it's an RStudio/RPresence compatibility issue? I'll try an earlier version of RStudio, and if that doesn't work, I'll just run the models through the console manually.

Re: Running occMod crashes my R session

PostPosted: Fri Nov 02, 2018 5:09 am
by ksl59
I figured I should post the actual answer to this question- passing a list instead of a character vector to unitnames in createPao() crashes R. Not sure why. But unitnames = as.character(unlist(my.unitnames, use.names = F)) does the trick. My issue was just another case of not closely reading the helpfile until hours after I boarded the struggle bus.