640
Le logiciel R
5.2- Permutation des paires d’octets :
nbval <- dim^2
indices <- rbind((1:nbval)\fois2,(1:nbval)\fois2-1)
indices <- as.numeric(indices)
x <- octets[indices]
5.3- Transformation vers les d´ ecimaux :
x <- matrix(x,ncol=2,byrow=TRUE)
test <- function(x) {
as.numeric(paste("0x",paste(x,collapse=""),sep=""))
}
valeurs <- apply(x,MARGIN=1,FUN=test)
5.4- X <- matrix(valeurs,nrow=dim,ncol=dim)
5.5- image(X,col=gray(0:100 / 100))
5.6- Installez le package AnalyzeFMRI. T´ el´ echargez les fichiers anat.img et
anat.hdr sur votre espace de travail, puis tapez les instructions suivantes :
require("AnalyzeFMRI")
Y <- f.read.volume("anat.img")
image(Y[,,1],col=gray(0:1000 / 1000))
E- Dessiner la carte d’une r´ egion fran¸ caise
5.1- Installez les packages maps et mapdata, puis chargez les en m´ emoire :
require("maps")
require("mapdata")
5.2- map("france")
5.3- france <- map("france",plot=FALSE)
5.4- Les donn´ ees de latitude/longitude sont organis´ ees dans france$x/france$y
pour chaque r´ egion dans france$names (jusqu’au prochain NA).
5.5- Vecteur des indices des NA :
indNA <- which(is.na(france$x))
5.6- nomdept <- "Gard"
5.7- inddept <- which(france$names==nomdept)
5.8- plot(france$x[indNA[inddept-1]:indNA[inddept]],
france$y[indNA[inddept-1]:indNA[inddept]],
type="l",main=nomdept,xlab="Longitude",ylab="Latitude")
Le logiciel R
5.2- Permutation des paires d’octets :
nbval <- dim^2
indices <- rbind((1:nbval)\fois2,(1:nbval)\fois2-1)
indices <- as.numeric(indices)
x <- octets[indices]
5.3- Transformation vers les d´ ecimaux :
x <- matrix(x,ncol=2,byrow=TRUE)
test <- function(x) {
as.numeric(paste("0x",paste(x,collapse=""),sep=""))
}
valeurs <- apply(x,MARGIN=1,FUN=test)
5.4- X <- matrix(valeurs,nrow=dim,ncol=dim)
5.5- image(X,col=gray(0:100 / 100))
5.6- Installez le package AnalyzeFMRI. T´ el´ echargez les fichiers anat.img et
anat.hdr sur votre espace de travail, puis tapez les instructions suivantes :
require("AnalyzeFMRI")
Y <- f.read.volume("anat.img")
image(Y[,,1],col=gray(0:1000 / 1000))
E- Dessiner la carte d’une r´ egion fran¸ caise
5.1- Installez les packages maps et mapdata, puis chargez les en m´ emoire :
require("maps")
require("mapdata")
5.2- map("france")
5.3- france <- map("france",plot=FALSE)
5.4- Les donn´ ees de latitude/longitude sont organis´ ees dans france$x/france$y
pour chaque r´ egion dans france$names (jusqu’au prochain NA).
5.5- Vecteur des indices des NA :
indNA <- which(is.na(france$x))
5.6- nomdept <- "Gard"
5.7- inddept <- which(france$names==nomdept)
5.8- plot(france$x[indNA[inddept-1]:indNA[inddept]],
france$y[indNA[inddept-1]:indNA[inddept]],
type="l",main=nomdept,xlab="Longitude",ylab="Latitude")
