Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gRbase::stepwise function makes R session abort #10

Open
AlessioBoetti opened this issue Jan 11, 2022 · 4 comments
Open

gRbase::stepwise function makes R session abort #10

AlessioBoetti opened this issue Jan 11, 2022 · 4 comments

Comments

@AlessioBoetti
Copy link

AlessioBoetti commented Jan 11, 2022

Hi!
I'm using RStudio (RStudio 2021.09.1+372 "Ghost Orchid" Release for Windows, R version 4.1.2) on Windows 10 x64.

I trying to create an Undirected Graph from a dataset:

library(gRbase)
library(gRim)
library(gRain)
data(BodyFat)
BodyFat <- BodyFat[-c(31,42,48,76,86,96,159,169,175,182,206),]
BodyFat$Age <- sqrt(BodyFat$Age)
BodyFat$Weight <- sqrt(BodyFat$Weight)
names(BodyFat)[names(BodyFat) == 'BodyFat'] <- 'BodyFatPerc'
gRbodyfat <- BodyFat[,2:15]
graph.MyGraph <- cmod(~.^., data = gRbodyfat)
AIC.MyGraph <- gRbase::stepwise(graph.MyGraph)

I'm still exploring RStudio and graphical models, so I run these lines from the console, one by one. When I run the last line of code, R session aborts and I get the following pop-up message:

Screenshot (285)

I've also tried the following lines of code (I changed the last line):

library(gRbase)
library(gRim)
library(gRain)
data(BodyFat)
BodyFat <- BodyFat[-c(31,42,48,76,86,96,159,169,175,182,206),]
BodyFat$Age <- sqrt(BodyFat$Age)
BodyFat$Weight <- sqrt(BodyFat$Weight)
names(BodyFat)[names(BodyFat) == 'BodyFat'] <- 'BodyFatPerc'
gRbodyfat <- BodyFat[,2:15]
graph.MyGraph <- cmod(~.^., data = gRbodyfat)    
AIC.MyGraph <- stepwise(graph.MyGraph)

but I get the same problem. I tried six or seven times running those lines of code, R aborted everytime.

My gRbase, gRim, gRain, Rgraphviz and RBGL libraries are in the home folder:
C:/Users/MyUser/Documents/R/win-library/4.1

I've tried doing this:

  • Reinstalling gRbase, gRim, gRain, Rgraphviz, RBGL, graph, BiocManager, BiocVersion, BiocGenerics, Rcpp, RcppArmadillo, RcppEigen libraries. I've tried doing this after restarting the session and clearing the workspace and even after reinstalling RStudio and R (both last versions)
  • Installing Rtools (last version) (as explained here) and reinstalling all the libraries above
  • Reinstalling R, Rtools and Rstudio (last versions) and reinstalling all the libraries above
  • Executing RStudio as Administrator and reinstalling all the libraries above
  • Changing computer (Windows 10 x64) and installing R, Rtools, RStudio, and all the libraries above as Administrator

They didn't work. Don't know why R session aborts.

When installing libraries I followed these instructions:

@hojsgaard
Copy link
Owner

Can you send report from sessionInfo() please; are all packages updated?
Best S

@AlessioBoetti
Copy link
Author

AlessioBoetti commented Jan 11, 2022

I tried updating all packages, it didn't work.
I've tried uninstalling/reinstalling R, Rtools, RStudio, reinstalling libraries, updating them, I've tried launching RStudio as Administrator, I've tried changing computer. Still got the problem.

The last thing I tried (let's call it LAST TRIAL) is this:

  • uninstalling R, Rtools and RStudio
  • deleting .RData and .Renviron files in the Documents folder
  • deleting all libraries
  • downloading R (latest version) from CRAN webpage and installing it as Administrator
  • downloading Rtools (latest version from webpage) and installing it as Administrator
  • creating the .Renviron file as described here
  • downloading RStudio (latest version from webpage) and installing it as Administrator
  • installing BiocManager as described here (when asked to update Matrix library I said NO, I thought it could be the problem)
  • installing gRbase, gRim, gRain libraries as described here (when asked to update fansi library I said NO because it said "There are binary versions available but the source versions are later", I thought it could be the problem)
  • Tried again the lines of code

Still got the problem, R session aborted again.

A friend of mine doing a similar project used gRbase::stepwise function, so I inserted his code in the console and the function worked. So I think the problem might be the object of the function, graph.MyGraph. The cmod function works fine, so maybe there's a problem with gRbodyfat, which is used to build graph.MyGraph.

If I run these lines (I tried changing the dataset, I used BodyFat instead of gRbodyfat):

graph.MyGraph <- cmod(~.^., data = BodyFat)
AIC.MyGraph <- gRbase::stepwise(graph.MyGraph)

I get the following error:

Error in dim(res) <- c(NSEL, NSET) : 
dims [product 210] do not match the length of object [14]

This is the report from sessionInfo() after LAST TRIAL before AIC.MyGraph <- stepwise(graph.MyGraph) line:

R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=Italian_Italy.1252  LC_CTYPE=Italian_Italy.1252    LC_MONETARY=Italian_Italy.1252
[4] LC_NUMERIC=C                   LC_TIME=Italian_Italy.1252    
system code page: 65001

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] SignifReg_4.2  gRim_0.2.5     gRbase_1.8-6.7

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7          lattice_0.20-45     gRain_1.3-6         grid_4.1.2          RBGL_1.68.0        
 [6] stats4_4.1.2        magrittr_2.0.1      graph_1.70.0        carData_3.0-5       car_3.0-12         
[11] Rgraphviz_2.36.0    Matrix_1.3-4        tools_4.1.2         igraph_1.2.11       abind_1.4-5        
[16] parallel_4.1.2      compiler_4.1.2      pkgconfig_2.0.3     BiocGenerics_0.38.0

And this is the report from sessionInfo() after R session aborts, when the session is restarted:

R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=Italian_Italy.1252  LC_CTYPE=Italian_Italy.1252    LC_MONETARY=Italian_Italy.1252
[4] LC_NUMERIC=C                   LC_TIME=Italian_Italy.1252    
system code page: 65001

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] compiler_4.1.2      magrittr_2.0.1      Matrix_1.3-4        parallel_4.1.2      tools_4.1.2        
 [6] igraph_1.2.11       gRbase_1.8-6.7      Rcpp_1.0.7          grid_4.1.2          Rgraphviz_2.36.0   
[11] BiocGenerics_0.38.0 pkgconfig_2.0.3     stats4_4.1.2        lattice_0.20-45     graph_1.70.0

If it's not a bug, sorry for the inconvenience.

@AlessioBoetti
Copy link
Author

AlessioBoetti commented Jan 11, 2022

I've tried debugging gRbase::stepwise function, R session aborts when I execute the yellow line:

Screenshot (287)

The problem appears to be iModel function

@AlessioBoetti
Copy link
Author

I've discovered that if I use graph.MyGraph <- cmod(~.^1, data = gRbodyfat) the gRbase::stepwise function works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants