Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cspade function in arulesSequences throws connection error

Tags:

r

I am using arulesSequences R library. This part of the code works fine:

x <- read_baskets(con = system.file("misc", "zaki2.txt", package = "arulesSequences"), info = c('sequenceID', 'eventID', 'SIZE', 'items'))

The zaki2.txt is located in

C:\Users\USERNAME\Documents\R\win-library\3.5\arulesSequences\misc

However, when I run the following code:

s1 <- cspade(x, parameter = list(support = 0.1, maxsize = 1, maxlen = 1), control = list(verbose = TRUE))

I receive the following error:

Error in file(con, "r") : cannot open the connection
      3. file(con, "r") 
      2. read_spade(con = out, labels = itemLabels(data), transactions = if (control@tidLists) data, class = class) 
      1. cspade(x, parameter = list(support = 0.1, maxsize = 1, maxlen = 1), control = list(verbose = TRUE))

I just wonder why this connection problem occurs. I gave full access controls to this folder (I am using Windows 10), but still receiving the same error. Any help?

UPDATE

I found further details regarding the error. I checked this folder, and it seems that there is no *.out file in the directory.

reading sequences ...cannot open file 
'C:\Users\ERKANE~1\AppData\Local\Temp\RtmpohPsWy\cspade3894f1b4b9f.out': No 
such file or directoryError in file(con, "r") : cannot open the connection
like image 677
renakre Avatar asked Jun 16 '26 17:06

renakre


2 Answers

This is because you did not get write permission to the temporary folder "C:\Users\ERKANE~1\AppData\Local\Temp\RtmpohPsWy".

You can run R.exe as an administrator instead of Rstudio, or delete the read-only attribute of the temporary folder.

like image 163
Kuang Junwei Avatar answered Jun 19 '26 06:06

Kuang Junwei


Why don't you just give the full path to the file?

Try printing the warnings - they probably mention a file not found.

Do set mustWork=T if you require the file.

What is the output of

fn <- system.file("misc", "zaki2.txt", package = "arulesSequences", mustWork=T)

And

fn2 <- system.file("misc/zaki2.txt", package = "arulesSequences", mustWork=T)
like image 26
Has QUIT--Anony-Mousse Avatar answered Jun 19 '26 07:06

Has QUIT--Anony-Mousse