r - t.test on data formatted for boxplot -


i have data formatted in way. says algorithm had result 1 on input1 , other had result 0.6 on input1.

label input1 input2 mine  1       0.9 mine  0.9     0.7 mine  0.5     0.2 other 0.6     0.7 other 0.8     0.3 other 0.3     0.1 

after searching lot on internet, succeeded plot nice boxplot:

library(reshape2) library(lattice) dataset <- read.table("sample.txt", header=true, sep="", na.strings="na", dec=".", strip.white=true) dat.m <- melt(dataset,id.vars='label') bwplot(value~label | paste0(variable), data=dat.m,   main="mine vs other", layout=c(2,1), par.settings = list(box.rectangle = list(fill= rep(c('blue','red'),2)))) 

how can perform paired t.test comparing mine vs other?

i guess whole problem due new format , melt not used to. way used before putting mine in 1 colunm , other in column , call this:

t.test(dataset$mine,dataset$other,paired=t).

thanks

i found 2 options of doing it:

mine = subset(dataset, dataset$label=="mine") other = subset(dataset, dataset$label=="other") t.test(mine,other) 

or more pointed out:

t.test(value ~ label, data = dat.m) 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -