
cholest<-read.table("cholestr.txt",header=TRUE)

View(cholest)

t.test(cholest$Day2,mu=260)

ownfunction<-function(a,b){
  return(2*a+b)  
}

ownfunction(-2,3)



tdensity<-function(degreeoffreedom){

library(stats)    
  library(graphics)
  library(utils)
  
  xaxis<-seq(-3,3,0.01)
  
  for(i in 1:degreeoffreedom){
    yaxis<-xaxis
    yaxisnorm<-xaxis
    
    for(j in 1:length(xaxis)){
      
      yaxis[j]<-dt(xaxis[j],i)
      yaxisnorm[j]<-dnorm(xaxis[j],0,1)
      
    }
    
    picturename<-paste("tdensity",toString(i),".jpg",sep="")
    
    jpeg(picturename)
    
    plot(xaxis,yaxis,ylim=c(0,0.4))
    lines(xaxis,yaxisnorm,col="GREEN")
    dev.off()
    
  }
}


tdensity(10)










cholesterolnew<-read.table("cholestg.txt",header=TRUE)


View(cholesterolnew)


cholesterolnew2<-subset(cholesterolnew,day==2)
View(cholesterolnew2)

cholesterolnew2<-cholesterolnew2[c("patient","group","cholest")]

View(cholesterolnew2)

colnames(cholesterolnew2)<-c("patient","group","cholest2")

#the next line does the same as the previous one
colnames(cholesterolnew2)[[3]]<-"cholest2"


View(cholesterolnew2)












