#Chapitre 1
#page 9

#q()

#page 10
help(read.table)

#help(package="package")
# par exemple
help(package="MASS")

example(plot)
## 
## plot> require(stats) # for lowess, rpois, rnorm
## 
## plot> plot(cars)

## 
## plot> lines(lowess(cars))
## 
## plot> plot(sin, -pi, 2*pi) # see ?plot.function

## 
## plot> ## Discrete Distribution Plot:
## plot> plot(table(rpois(100, 5)), type = "h", col = "red", lwd = 10,
## plot+      main = "rpois(100, lambda = 5)")

## 
## plot> ## Simple quantiles/ECDF, see ecdf() {library(stats)} for a better one:
## plot> plot(x <- sort(rnorm(47)), type = "s", main = "plot(x, type = \"s\")")

## 
## plot> points(x, cex = .5, col = "dark red")
# page 11
help("read.table",help_type="html")
## starting httpd help server ... done
help("read.table",help_type="text")
help.start()
## If the browser launched by '/usr/bin/open' is already running, it
##     is *not* restarted, and you must switch to its window.
## Otherwise, be patient ...
#page 12
n<-28
N<-20

m=1973
m
## [1] 1973
N+n
## [1] 48
# page 13
rm(m)

rm(n,N)

2 + 8
## [1] 10
# page 14

120:155
##  [1] 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
## [18] 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
## [35] 154 155
sqrt(4)
## [1] 2
# page 15
# source(file="C://chemin//vers//nomdefichier// + fichier.R",echo=T)
# source(file=".../repertoire/fichier.R",echo=T)
# source("fichier.R",echo=T)

# page 19, exercice 1.3 
f <- function(x){ 
  return (3*x^2) 
  }

# page 19, exercice 1.4 
a <- 3
if (a > 5) {
  print("a est plus grand que 5") 
} else { 
  print ("a est plus petit que 5") 
}
## [1] "a est plus petit que 5"