Re: [R] package "arules" - 'transpose' of the transactions

2010-12-20 Thread Kohleth Chia
Just found 'ngCMatrix' class, it must be the way to go? - Message: 47Date: Mon, 20 Dec 2010 17:41:20 +1100 From: Kohleth Chia To: r-help@r-project.org Subject: [R] package "arules" - 'transpose' of the transactions Messa

[R] package "arules" - 'transpose' of the transactions

2010-12-19 Thread Kohleth Chia
Suppose this is my list of transactions: set.seed(200) tran=random.transactions(100,3) inspect(tran) itemstransactionID 1 {item80}trans1 2 {item8, item20}trans2 3 {item28}trans3 I want to get the 'transpose' of the data, i.e. transactionID items 1 {trans2

[R] Replacing 1 plot in layout

2010-11-24 Thread Kohleth Chia
Hi, layout(1:2) # split the screen into 2 regions plot(1:2) # plot in region 1 plot(1:2) # plot in region 2 par(mfg=c(1,1)) # Then I want to update the plot in region 1 plot(1.5,1.5) But the this last plot overlays with my 1st plot. Q: How do I replace my first plot with my last? NOTE ##

Re: [R] Getting user input without hitting enter

2010-11-24 Thread Kohleth Chia
elp-boun...@r-project.org [mailto:r-help-boun...@r- >> project.org] On Behalf Of Kohleth Chia >> Sent: Wednesday, November 24, 2010 5:53 AM >> To: r-help@r-project.org >> Subject: [R] Getting user input without hitting enter >> >> Hi, >> >> I am writin

[R] Getting user input without hitting enter

2010-11-24 Thread Kohleth Chia
Hi, I am writing a function which requires user to enter a single character. Something like: hello<-function(){ input<-scan(n=1,what="a") if(input=="h")cat("Hello") # What goes after the 'if' is completely arbitrary, for simplicity sake I simply put a cat command here. } I want

Re: [R] cochran Q test

2010-09-29 Thread Kohleth Chia
; Cochran-Mantel-Haenzel test, of which Cochran's Q is a special case: > > mantelhaen.test > cmh.test (lawstat package) > > D. > > On Tue, Sep 28, 2010 at 5:46 AM, Kohleth Chia wrote: > Thanks for all the suggestions. It seems that I still have to write my own >

Re: [R] cochran Q test

2010-09-28 Thread Kohleth Chia
.ch/pipermail/r-help/2006-September/113156.html > > HTH, > Dennis > > On Mon, Sep 27, 2010 at 7:27 PM, Kohleth Chia wrote: > Dear all, > > I am trying to look for a built in function that performs the cochran Q > test. > that is, cochranq.test(X) > where X is a

[R] cochran Q test

2010-09-27 Thread Kohleth Chia
Dear all, I am trying to look for a built in function that performs the cochran Q test. that is, cochranq.test(X) where X is a contingency table (maybe a matrix or data.frame). The output will naturally be the test statisitcs, p-value, etc. A quick search on Google gives me the cochran.test in th

[R] Vectorize multiple loops

2010-01-29 Thread Kohleth Chia
Hi, How can we vectorize multiple for loops? E.g. how do you vectorize this: for (i in 1:10){ for(j in 1:25){ for(k in 1:19){ x[i,j,k]=i*k-j } } } THanks KC __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listi

[R] lpSolve API - add Vs set

2010-01-28 Thread Kohleth Chia
Hi, Using the package lpSolve API, I need to build a 2000*10 constraint matrix. I wonder which method is faster: (a) model = make.lp(0,0) add.constraint(model, ...) or (b) model = make.lp(2000,10) set.constraint(model,...) Thanks KC _

[R] coerce vector into array - change filling sequence

2010-01-12 Thread Kohleth Chia
Dear all, When I coerce a vector into a multi dimensional array, I would like R to start filling the array along the last dimension, then the 2nd last etc. Let's jump straight into an example. x <- 1 : 24 y <- array(dim=c(2,2,6)) I would like to have: y[1,1,1] = 1 y[1,1,2] = 2 ... y[1,1,6] = 6