[R] test

romzero romzero at yahoo.it
Sat Jan 15 00:12:45 CET 2011


Thank you all for the precious help.

Finally i could start the writing of a first part of my script, but now i
have a new question for you.

Need i to repeat the write.table portion for all the 15 lines or can i use a
"short cut"?

Example:

file.open <- "C:\\test.txt"
file.save <- "C:\\results.txt"

my.data <- read.table(file, header=T)

library(plyr)
write.table(ddply(my.data, .(Thesis, Day), function(x){
        Baseline <- unlist(x[1, c("A", "B", "C")])
        data.frame(t(apply(x[-1, c("A", "B", "C")], 1, function(z){z -
Baseline})))
}), file = file.save, row.names = F) 
write.table(ddply(my.data, .(Thesis, Day), function(x){
        Baseline <- unlist(x[2, c("A", "B", "C")])
        data.frame(t(apply(x[-1:-2, c("A", "B", "C")], 1, function(z){z -
Baseline})))
}), file = file.save, append = T, row.names = F, col.names = F) 
etc etc

Thanks again for the help.

Best regards,
Roberto.
-- 
View this message in context: http://r.789695.n4.nabble.com/Comparison-of-numbers-in-a-table-tp3217329p3218524.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list