#Chapitre 1
#page 9
#q()
?read.table
#page 10
help(read.table)
#help(package="package")
example(plot)
##
## plot> Speed <- cars$speed
##
## plot> Distance <- cars$dist
##
## plot> plot(Speed, Distance, panel.first = grid(8, 8),
## plot+ pch = 0, cex = 1.2, col = "blue")
##
## plot> plot(Speed, Distance,
## plot+ panel.first = lines(stats::lowess(Speed, Distance), lty = "dashed"),
## plot+ pch = 0, cex = 1.2, col = "blue")
##
## plot> ## Show the different plot types
## plot> x <- 0:12
##
## plot> y <- sin(pi/5 * x)
##
## plot> op <- par(mfrow = c(3,3), mar = .1+ c(2,2,3,1))
##
## plot> for (tp in c("p","l","b", "c","o","h", "s","S","n")) {
## plot+ plot(y ~ x, type = tp, main = paste0("plot(*, type = \"", tp, "\")"))
## plot+ if(tp == "S") {
## plot+ lines(x, y, type = "s", col = "red", lty = 2)
## plot+ mtext("lines(*, type = \"s\", ...)", col = "red", cex = 0.8)
## plot+ }
## plot+ }
##
## plot> par(op)
##
## plot> ##--- Log-Log Plot with custom axes
## plot> lx <- seq(1, 5, length.out = 41)
##
## plot> yl <- expression(e^{-frac(1,2) * {log[10](x)}^2})
##
## plot> y <- exp(-.5*lx^2)
##
## plot> op <- par(mfrow = c(2,1), mar = par("mar")-c(1,0,2,0), mgp = c(2, .7, 0))
##
## plot> plot(10^lx, y, log = "xy", type = "l", col = "purple",
## plot+ main = "Log-Log plot", ylab = yl, xlab = "x")
##
## plot> plot(10^lx, y, log = "xy", type = "o", pch = ".", col = "forestgreen",
## plot+ main = "Log-Log plot with custom axes", ylab = yl, xlab = "x",
## plot+ axes = FALSE, frame.plot = TRUE)
##
## plot> my.at <- 10^(1:5)
##
## plot> axis(1, at = my.at, labels = formatC(my.at, format = "fg"))
##
## plot> e.y <- -5:-1 ; at.y <- 10^e.y
##
## plot> axis(2, at = at.y, col.axis = "red", las = 1,
## plot+ labels = as.expression(lapply(e.y, function(E) bquote(10^.(E)))))
##
## plot> par(op)
help("read.table",help_type="html")
## démarrage du serveur d'aide httpd ... fini
#page 11
help("read.table",help_type="text")
help.start()
## Si '/usr/bin/open' est déjà lancé, il ne sera pas relancé, et vous
## devez passer à sa fenêtre.
## Sinon, soyez patient...
options(help_type="html")
options(help_type="text")
2+8
## [1] 10
#page 12
2+8
## [1] 10
120:155
## [1] 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
## [20] 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
sqrt(4)
## [1] 2
#page 13
#source(file="C://chemin//vers//nomdefichier//fichier.R",echo=TRUE)
#source(file=".../repertoire/fichier.R",echo=TRUE)
#source(file="fichier.R",echo=TRUE)
## Si "fichier.R" est dans le r\'epertoire de travail
# Exercice 1.1
#page 18
#install.packages("BioStatR")
help(package="BioStatR")
#install.packages("devtools")
#library(devtools)
#install_github("fbertran/BioStatR")
# Exercice 1.2
# 1)
10:25
## [1] 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#page 19
seq(from=10,to=25,by=1)
## [1] 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
seq(10,25,1)
## [1] 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
# 2)
seq(from=20,to=40,by=5)
## [1] 20 25 30 35 40
seq(20,40,5)
## [1] 20 25 30 35 40
# 3)
rep(x=28,times=10)
## [1] 28 28 28 28 28 28 28 28 28 28
#page 20
rep(28,10)
## [1] 28 28 28 28 28 28 28 28 28 28