Posts

Showing posts from November, 2024

Rp

1) Program to illustrate if else { a<-c(1,2,3) b<-c(4,5,6) if(length(a)==length(b)) {   print("same") }else{   print("not Same") } } 2) Program to illustrate for loop and stop condition { for(i in 1:10) {   print(paste("i=",i))   if(i==5)   {     stop("iteration stopped on condition at i=5")   } } } 3)programe to Find factoriel of the the given number {   fact=function(n)   {     if(n<=1)       return(1)     else       return(n*fact(n-1))   }   n=as.numeric(readline("enter a number"))   print(paste("the factoreialof ",n,"=",fact(n))) }   4) Program to Implement t test  groupA<-c(18,21,24,27,30) groupB<-c(17,20,23,26,29) res_ttest<-t.test(groupA,groupB) res_ttest 5) Programe to write the t apply and s apply functions values<-c(42,55,38,65,49,72,53,66,41,58) groups<-factor(c("A","B","A","B","A","B","A","B","A...