I got column means and range(min, max) from my data.
df=matrix(c(3, 5, 2, 3, 6, 3,4, 4, 4, 5, 4, 3,5, 5, 5),ncol=3,byrow=TRUE)
colnames(df)<-paste0("ch", 1:ncol(df))
rownames(df)<-paste0("G", 1:nrow(df))
mean<- colMeans(df, na.rm = FALSE, dims = 1)
range<-apply(df, 2, range)
rownames(range) <- c("min","max")
res<-rbind(mean,range)
I have a standard mean value(4). Now I want to add additional row showing significant marks(**) with the existing output. Mean values less than 4 were considered significant. Somehow I got significant marks but I failed to add this with the existing result.
f<-res[1,] <4
test <- factor(f, labels=c("Ns", "**"))
result<-rbind(mean,range,test)
result
ch1 ch2 ch3
mean 4 4.8 3.4
min 3 4.0 2.0
max 5 6.0 5.0
test 1 1.0 2.0
I wanted this like following one
ch1 ch2 ch3
mean 4 4.8 3.4
min 3 4.0 2.0
max 5 6.0 5.0
test Ns Ns **
I need your help to solve this.