Skip to content

arulesSequences Package

4 messages · Jeff Reichman, Bert Gunter, William Dunlap

#
R-Help Forum

For anyone who has used the "arulesSequences" Package how do I start with
raw data (*.csv file) and convert into a sequence object to run the cSPADE
function.  The package example use zaki dataset which has already been
converted.  When I state raw data how should I structure my csv file?

A web example  or RPubs link?

For example 
Seq_1	{E,B}, {C}, {T}
Seq_2 	(E,M}, {C}, {B,E,V,T}
Seq_3 	{E},{C},{T}

Jeff Reichman
#
I Was able to figure out how to create my object using the "read_baskets"
function but when I run the "cspade" function I receive the following error
(running in RStudio)
...
4 -> 1 2 -> 1 -> 1 -- 1 1 
3 -> 1 2 -> 1 -> 1 -- 1 1 
3 4 -> 1 2 -> 1 -> 1 -- 1 1 
3 4 -> 1 -> 1 -> 1 -- 1 1 
 NA MB [2.4s]
reading sequences ...Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
  cannot open file
'C:\Users\reichmanj\Documents\R\R-3.5.1\library\arulesSequences\misc\cspade1
f8c30bb5148.out': No such file or directory
Error in .class1(object) : object 's1' not found

But if I run in R (alone) it works just fine.  Any idea why I can' t seem to
run in RStudio or what I might have to do in RStudio?

-----Original Message-----
From: R-help <r-help-bounces at r-project.org> On Behalf Of Jeff Reichman
Sent: Monday, October 1, 2018 4:48 PM
To: r-help at r-project.org
Subject: [R] arulesSequences Package

R-Help Forum

For anyone who has used the "arulesSequences" Package how do I start with
raw data (*.csv file) and convert into a sequence object to run the cSPADE
function.  The package example use zaki dataset which has already been
converted.  When I state raw data how should I structure my csv file?

A web example  or RPubs link?

For example 
Seq_1	{E,B}, {C}, {T}
Seq_2 	(E,M}, {C}, {B,E,V,T}
Seq_3 	{E},{C},{T}

Jeff Reichman

______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
#
"But if I run in R (alone) it works just fine.  Any idea why I can' t seem
to
run in RStudio or what I might have to do in RStudio?"

This is the R-Help list; RStudio is a totally separate software product,
Any questions you have on RStudio software should be directed to their
site,not here.

Cheers,
Bert



Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Mon, Oct 1, 2018 at 5:03 PM Jeff Reichman <reichmanj at sbcglobal.net>
wrote:

  
  
#
Warning message:t
In file(con, "r") :
  cannot open file
'C:\Users\reichmanj\Documents\R\R-3.5.1\library\arulesSequences\misc\cspade1

f8c30bb5148.out': No such file or directory

It is hard to say what you did wrong when we only see R's output and not
what you typed to provoke the error.  However, this file it is trying to
read looks like something that tempfile() would have made if the tempdir()
function were messed up or if you gave an inappropriate directory name as
the tmpdir argument to arulesSequences::cspade.  You should not generally
give the tmpdir argument to cspade, as the default, tempdir(), should
work.  Did you supply it?  What does tempdir() return in the case that this
fails?

As an added complications, cspade redefines the system2 function if
.Platfom$OS.type is
"windows" and .Platform$GUI is "RGui".
    ## workaround
    if (.Platform$OS  == "windows" &&
        .Platform$GUI == "Rgui")
        system2 <- function(command, args = character(), stdout = "", ...) {
            if (is.character(stdout) && nzchar(stdout)) {
                args   <- c(args, ">", stdout)
                stdout <- NULL
            }
            args <- c("/c", shQuote(command), args)
            command <- Sys.getenv("COMSPEC")
            ## bail out
            if (!nzchar(command))
                stop("environment variable 'COMSPEC' not set")
            base::system2(command, args = args, stdout = stdout, ...)
        }

RStudio redefines .Platform$RGui to be "RStudio" so this redefinition does
not happen.  The author or maintainer of the package might be able to
straighten this part out.


Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Mon, Oct 1, 2018 at 5:02 PM, Jeff Reichman <reichmanj at sbcglobal.net>
wrote: