Hi dear R-users,
I encountered an interesting pattern. Take for example the function
combn(), I copied and pasted the function definition and saved it as a new
function named combn2() (see the end of this email). As it turned out,
combn2() seems to be substantially slower than the original
Does this work? Probably not the fastest, but I think it does the job.
foo-function(x){
temp=x[x0]
if(length(temp)=3) sum(temp[1:3])
else sum(temp)
set.seed(2)
mat-matrix(sample(0:4, 25, replace=T, prob=c(1/2,rep(1/8,4)), ncol=5)
mat
# [,1] [,2] [,3] [,4] [,5]
#[1,]012
parenthesis.
mat
On Tue, May 21, 2013 at 3:47 AM, Xiao He praguewaterme...@gmail.com wrote:
Does this work? Probably not the fastest, but I think it does the job.
foo-function(x){
temp=x[x0]
if(length(temp)=3) sum(temp[1:3])
else sum(temp)
set.seed(2)
mat-matrix(sample(0:4, 25, replace=T
That's a good one, Using cumsum + rowsum would definitely be faster,
On Tue, May 21, 2013 at 6:40 AM, José Verhoeven j...@memo2.nl wrote:
Thank you, that really worked. Actually received an even shorter version:
rowSums((t(apply(D 0, 1, cumsum)) = 3) * D)
2013/5/21 Xiao He
Dear R-users:
Hi, I read here (
http://stackoverflow.com/questions/2287616/controlling-digits-in-r) that R
is only accurate up to the 15th decimal place, despite the fact that if you
choose to display more decimal places, it will. I wonder if R uses the
information beyond the 15th decimal place
Dear R users,
I posted a couple of questions and got no response, so I am giving it
another shot.
I ran an experiment with a TWO-WAY within subject design. A sample dataset
is in http://www-scf.usc.edu/~hex/data.txt
I already ran ANOVA by using the following formula:
aov(RT~Factor1*Factor2 +
Dear R people,
I have a couple of questions about post-doc analyses for 2 by 2 within
subjects ANOVA. I conducted a psycholinguistic study that combined a 2 by 2
design and a latin square design. Specifically, I had 32 items each of which
generated 4 conditions. Participants saw each of the 32
Sorry, that in the last message the tables were messed up. Here is a link to
the tables http://www-scf.usc.edu/~hex/data.txt
http://www-scf.usc.edu/~hex/data.txtThanks!
On Sun, Jun 6, 2010 at 10:18 AM, Xiao He praguewaterme...@gmail.com wrote:
Dear R people,
I have a couple of questions
8 matches
Mail list logo