打开命令行窗口,运行C:\soft\R\bin\Rscript.exe D:\test\total.txt

sink(file = "D://test//totalResult.txt",append = FALSE,type = c("output","message"),split = FALSE)

 

x1 x2 x3 y
tech1 tech13 pos2 0.5
tech2 tech12 pos1 0.6
tech3 tech11 pos3 0.7
tech2 tech12 pos1 0.4
tech3 tech11 pos3 0.6

my_data<-read.csv(t.txt)

model <- lm(y~ x1+x2+ x3, data=my_data)

model

 

 

---

t检验

x <- c(tech1, tech2, tech3, tech2, tech3)
x2 <- c(tech13, tech12, tech11, tech12, tech11)
x3 <- c(pos2, pos1, pos3, pos1, pos3)
y <- c(0.5, 0.6, 0.7, 0.4, 0.6)

t.test(y,x,var.equal = TRUE,alternative = "less")