There is a friedman.test() function. Any reason you want to do it by hand? If so, you can do:
#Simulated data matrix x<-matrix(rnorm(9),3,3,byrow=T) x #Rank matrix r<-matrix(rank(x),dim(x)) HTH, Daniel JohnnyJames wrote: > > My data looks like this: > (treatments) > T1 T2 T3 > DK 8 5 3 > > JP 5 4 1 > > AS 9 7 4 > > MK 8 4 4 > > DK, JP, AS, and MK are 4 different people (blocks) I am using. > > This is my code so far: > >> treat<-c("J","J","J","J","U","U","U","U","H","H", "H", "H") > >> y<-c(8,5,3,5,4,1,9,7,4,8,4,4) > >> block<-c("DK","JP","AS","MK","DK","JP","AS","MK","DK","JP","AS","MK") > >> ranks<-matrix(NA,nrow=4,ncol=3) > >> for (i in 1:4) ranks[i,]<-?????????????????? > > I know that once I can get the ranks stored I can do a command like below. > >> summary(aov(as.vector(ranks)~factor(treat)+factor(block))) > > Can someone help me store the data as ranks? > -- View this message in context: http://r.789695.n4.nabble.com/Performing-a-non-parametric-Friedman-Test-tp3939045p3939430.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list 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.