Reputation: 319
When trying to use the sample code for SubgraphMining (the example is on 35th page), I get an error:
"Error in setwd(paste(Sys.getenv("R_HOME"), "library", "subgraphMining", :
cannot change working directory"
I'm using RStudio 0.97.551, 32-bit R (2.15.3 - this version of R was recommended to use with subgraphMining), igraph0 (was recommeded too, instead of igraph library), Java installed. Operation system is Windows 8. Can anyone help me with the issue?
Upvotes: 14
Views: 52281
Reputation: 1795
You can always use file.path("path","with","code") instead of simple paste in order for your code to be OS independent.
Upvotes: 0
Reputation: 1018
In my case, it displayed the error because I expected it to create a new folder which I mentioned in the path in setwd. Unfortunately, R does not have this functionality and the matter was resolved when I created the folder and then used setwd command.
Upvotes: 6
Reputation: 1150
I know it's almost 1 year since this question was posted. I encountered the same problem with subgraphMining package. A quick hack is: You can write "gspan" on RStudio's command line and it will show the function, copy that function and create your own function in your own script (of course with new name, let's say gspanNew) and fix it by replacing "\\" with "/", as Gabor Csardi pointed out.
Cheers! :)
Upvotes: 3
Reputation: 10825
The error message is coming from the gspan
function of subgraphMining
, from here:
setwd(paste(Sys.getenv("R_HOME"), "library", "subgraphMining",
"parsemis", sep = "\\"))
The reason for it is that R uses /
as path separator, and not \\
, which only works on windows. A workaround is not modify the function and use /
instead of \\
.
Btw. this has nothing to do with the igraph package, so I'll remove that tag.
Upvotes: 8