.packageName <- "lycee"
ajusteexponentielle<-function(d){ lines( seq(min(d),max(d),by=0.01), dexp(seq(min(d),max(d),by=0.01),1/mean(d))) }
ajustenormale<-function(d){ lines( seq(min(d),max(d),by=0.01), dnorm(seq(min(d),max(d),by=0.01),mean(d),sd(d))) }
boitemoustache<-function(d){boxplot(d)}
boitesparalleles<-function(d,f){boxplot(d~f)}
camembert<-function(d){pie(table(d))}
`diagrammeenbarre` <-
function(d){barplot(table(d)/length(d))}

ecarttype<- function(y){
 m <- sd(y)
 print("l'cart-type est : ")
 print(m)
 }
`frequence` <-
function(d){table(d)/length(d)}

histogramme<-function(d){hist(d,freq=FALSE)}
jeudedes<-function(n){trunc(6*runif(n,0,1))+1}
`lire` <-
function(d){attach(d) 
d}

liretableauexcell<-function(d){tab<-read.table(d,header=T,dec=',')
attach(tab)
tab}
liretableautxt<-function(d){tab<-read.table(d,header=T,dec=',')
attach(tab)
tab}
loinormale=function(x,m,s){
print("La proba que X soit infrieure ") 
print(x)
print(pnorm(x,m,s))
print("La proba que X soit suprieur ") 
print(x)
print(1-pnorm(x,m,s))
}
mediane<- function(y){
 m <- median(y)
 print("la mdiane est : ")
 print(m)
 }
 moyenne <- function(y){
 m <- mean(y)
 print("la moyenne est : ")
 print(m)
 }
nuagedepoints<-function(x,y ,couleur){plot(x,y,col=as.character(couleur))}
`pileface` <-
function(n){factor(rbinom(n,1,0.5),labels=c('p','f'))}

 population<-function(p){factor(rbinom(1000000,1,p),labels=c('oui','non'))}
`random` <-
function(a,b){runif(1,a,b)}

regression<-function(x,y){reg=lm(y~x)
print("la pente de la droite de rgression est:")
print(reg$coef[2])
print("l'ordonne  l'origine  est:")
print(reg$coef[1])
plot(x,y)
abline(coef=coef(reg),col='red')}
selection<-function(d1,d2,valeur){subset(d1,d2==valeur)}
simuleexponentielle<-function(n,m){d<-rexp(n,m)
d
moyenne(d)
ecarttype(d)
hist(d,freq=FALSE)
x=seq(from=0, to=1000/m, by=0.1)
lines(x,dexp(x,m),type='l',col='blue')}
simulenormale<-function(n,m,s){d<-rnorm(n,m,s)
d
moyenne(d)
mediane(d)
ecarttype(d)
hist(d,freq=FALSE)
x=seq(from=m-3*s, to=m+3*s, by=0.1)
lines(x,dnorm(x,m,s),type='l',col='blue')}
simulepoisson<-function(n,m){d<-rpois(n,m)
d
frequence(d)
diagrammeenbarre(d)
moyenne(d)
mediane(d)
ecarttype(d)
diagrammeenbarre(d)
x=0:4*m
lines(x,dpois(x,1/m),type='h',col='blue')}
sondage<-function(n,pop){sample(pop,size=n,replace=TRUE)}
tirage=function(n,u){sample(u,replace=TRUE,n)}
tirageloto<-function(n){ for (i in 1:n) { print(sample(1:49,size=6,replace=FALSE))}}

`tpileface` <-
function(n,pface){factor(rbinom(n,1,pface),labels=c('p','f'))}

urne=function(n1,n2,n3){rep(x=c("Bl","No","Ve"), times=c(n1,n2,n3))}
variance<- function(y){
 m <- var(y)
 print("la variance est : ")
 print(m)
 }
vecteur=function(a,b){c(a,b)}

voirvariables<-function(d){head(d)}
