Re: [R] Consequent sorting

2018-09-23 Thread Jeff Reichman
Never mind. Working with the arules package notes I was able to figure it out rules <- apriori(fp.trans, parameter = list(supp = 0.1, conf = 0.2, target = "rules"), appearance = list(rhs="Sugar", default="lhs"), control = list(verbose=F))

[R] Consequent sorting

2018-09-23 Thread Jeff Reichman
r-help Forum I'm using the following code to sort the "right-hand side (rhs, consequent) of the rules output from the arules packages, which works. But what I'd really like is the ability to subset my rules where the rhs = "some item set" rules_info <- data.frame( LHS =

Re: [R] For Loop

2018-09-23 Thread Bert Gunter
"... I learned to say "try it and see" in many different ways. " Version 2: *Never* parallelize your computations except when you should. ;-) -- Bert On Sun, Sep 23, 2018 at 1:20 PM Duncan Murdoch wrote: > On 23/09/2018 4:00 PM, Wensui Liu wrote: > > Very insightful. Thanks, Duncan >

Re: [R] error "The system cannot find the file specified..."

2018-09-23 Thread Ek Esawi
Thank you Bert and Rui. Everything mentioned on your posts was OK with the exception of a typo in my original post where [a] was instead [[a]]. I stumbled one something that stated if i delete the sub-directory and create it it again might work. In my case once that was done, it worked. Thanks

Re: [R] For Loop

2018-09-23 Thread Duncan Murdoch
On 23/09/2018 4:00 PM, Wensui Liu wrote: Very insightful. Thanks, Duncan Based on your opinion, is there any benefit to use the parallelism in the corporate computing environment where the size of data is far more than million rows and there are multiple cores in the server. I would say

Re: [R] For Loop

2018-09-23 Thread Wensui Liu
Very insightful. Thanks, Duncan Based on your opinion, is there any benefit to use the parallelism in the corporate computing environment where the size of data is far more than million rows and there are multiple cores in the server. Actually the practice of going concurrency or not is more

Re: [R] For Loop

2018-09-23 Thread Jeff Newmiller
On Sun, 23 Sep 2018, Duncan Murdoch wrote: On 23/09/2018 3:31 PM, Jeff Newmiller wrote: [lots of good stuff deleted] Vectorize is syntactic sugar with a performance penalty. [More deletions.] I would say Vectorize isn't just "syntactic sugar". When I use that term, I mean something that

Re: [R] For Loop

2018-09-23 Thread Duncan Murdoch
On 23/09/2018 3:31 PM, Jeff Newmiller wrote: [lots of good stuff deleted] Vectorize is syntactic sugar with a performance penalty. [More deletions.] I would say Vectorize isn't just "syntactic sugar". When I use that term, I mean something that looks nice but is functionally equivalent.

Re: [R] For Loop

2018-09-23 Thread Jeff Newmiller
On Sun, 23 Sep 2018, Wensui Liu wrote: what you measures is the "elapsed" time in the default setting. you might need to take a closer look at the beautiful benchmark() function and see what time I am talking about. When I am waiting for the answer, elapsed time is what matters to me. Also,

Re: [R] For Loop

2018-09-23 Thread Ista Zahn
On Sun, Sep 23, 2018 at 2:26 PM Wensui Liu wrote: > > what you measures is the "elapsed" time in the default setting. you > might need to take a closer look at the beautiful benchmark() function > and see what time I am talking about. I'm pretty sure you do not know what you are talking about.

Re: [R] For Loop

2018-09-23 Thread Jeff Newmiller
Below... On Sun, 23 Sep 2018, Sorkin, John wrote: At the risk of asking something fundamental . . . . does log(c1[-1]/c1[-len] You dropped the closing parenthesis. log( c1[-1] / c1[-len] ) do the following (1) use all elements of c and perform the calculation No. a) "c" is the base

Re: [R] For Loop

2018-09-23 Thread Duncan Murdoch
On 23/09/2018 2:36 PM, Sorkin, John wrote: At the risk of asking something fundamental . . . . does log(c1[-1]/c1[-len] do the following (1) use all elements of c and perform the calculation (2) delete the first element of c and perform the calculation, (2) delete the first two elements of

Re: [R] For Loop

2018-09-23 Thread Sorkin, John
At the risk of asking something fundamental . . . . does log(c1[-1]/c1[-len] do the following (1) use all elements of c and perform the calculation (2) delete the first element of c and perform the calculation, (2) delete the first two elements of c and perform the calculation, . . . (n)

Re: [R] For Loop

2018-09-23 Thread Wensui Liu
what you measures is the "elapsed" time in the default setting. you might need to take a closer look at the beautiful benchmark() function and see what time I am talking about. I just provided tentative solution for the person asking for it and believe he has enough wisdom to decide what's best.

Re: [R] For Loop

2018-09-23 Thread Ista Zahn
On Sun, Sep 23, 2018 at 1:46 PM Wensui Liu wrote: > > actually, by the parallel pvec, the user time is a lot shorter. or did > I somewhere miss your invaluable insight? > > > c1 <- 1:100 > > len <- length(c1) > > rbenchmark::benchmark(log(c1[-1]/c1[-len]), replications = 100) >

Re: [R] For Loop

2018-09-23 Thread Wensui Liu
actually, by the parallel pvec, the user time is a lot shorter. or did I somewhere miss your invaluable insight? > c1 <- 1:100 > len <- length(c1) > rbenchmark::benchmark(log(c1[-1]/c1[-len]), replications = 100) test replications elapsed relative user.self sys.self 1

Re: [R] For Loop

2018-09-23 Thread Ista Zahn
On Sun, Sep 23, 2018 at 10:09 AM Wensui Liu wrote: > > Why? The operations required for this algorithm are vectorized, as are most operations in R. There is no need to iterate through each element. Using Vectorize to achieve the iteration is no better than using *apply or a for-loop, and betrays

Re: [R] Smallest Space Analysis (SSA) in R

2018-09-23 Thread Michael Friendly
On 9/22/2018 6:49 AM, Andrew wrote: Hi Michael This looks like it could be really helpful in moving my project forwards thank you. I remember many years ago using (proprietary) software from the University of Liverpool which did a nice job of allowing regions to be defined, and then for

Re: [ESS] Stopping "Save workspace image?" prompt

2018-09-23 Thread Martin Maechler via ESS-help
On Sat, Sep 22, 2018 at 9:20 AM Jeremie Juste via ESS-help wrote: > > > Hello, > > Have a look at the variable inferior-R-args. (C-h v > inferior-R-args). You can customize it to include --no-save. > in principle putting (setq inferior-R-args "--no-save") in your .emacs > file should do it. Yes,

Re: [R] For Loop

2018-09-23 Thread Ista Zahn
On Sat, Sep 22, 2018 at 9:06 PM Wensui Liu wrote: > > or this one: > > (Vectorize(function(i) log(c1[i + 1] / c1[i])) (1:len)) Oh dear god no. > > On Sat, Sep 22, 2018 at 4:16 PM rsherry8 wrote: > > > > > > It is my impression that good R programmers make very little use of the > > for

Re: [R] Packaged exe and Shiny

2018-09-23 Thread Eric Berger
Hi Kevin, I did something along these lines using shiny and I had a good experience with it. You would require a server (virtual or physical) to run the shiny-server program. This approach is particularly suitable if your target users do not know (or use) R. If you go down this route I also

Re: [R] error "The system cannot find the file specified..."

2018-09-23 Thread Rui Barradas
Hello, I would add that it's probably better to assign for(i in seq_along(file.names)){ A[[i]] <- extract_tables(file.names[i]) } (It's a list so double [[, not just [). Hope this helps, Rui Barradas Às 01:45 de 23/09/2018, Bert Gunter escreveu: for(i in 1:length(file.names)){ A[i]