I have the code below, but I have error when executing the FUN
function
library(table1)
library(RVAideMemoire)
Practice<-c(rep("Clippings",14),rep("Irrigation",14),rep("MowHeight",14),rep("SoilTest",14))
Response<-c(rep("No",23),rep("Yes",33))
Student<-c(rep("a",4),rep("b",4),rep("c",4),rep("d",4),rep("e",4),rep("f",4),rep("g",4),rep("h",4),rep("i",4),rep("j",4),rep("k",4),rep("l",4),rep("m",4),rep("n",4))
dataset<-data.frame(Practice,Student,Response)
Fun<-function(data,var,Response,ID) {
tab<-table1(~ Response | var, data=data,topclass="Rtable1-zebra")
tab<-as.data.frame(tab)
test<-cochran.qtest(Response ~ var | ID,data = data)
pvalue<-test$p.value
list<-c(pvalue,tab)
return(list)
}
Fun(dataset,Practice,Response,Student)
I want to print both pvalue
and tab
, and this is the error I got
is there any possibility to correct it ?