Example 1
First example, using the ade4 library and showing how to do a coinertia analysis :
Example 2
Here is the example showing
how you can search sequence data banks for gene sequences,
compute the codon frequences for these genes, and perform a correspondence analysis (CA)
of the frequencies table. This example makes the CA of the codon frequencies in the coding sequences
of Mycoplasma genitalium .
The web page explaining this example is here .
choosebank(bank = "emglib") # chooose the emglib sequence bank
req <- query("liste", "sp=mycoplasma genitalium et t=cds") # search the bank for sequences
seqs <- lapply(liste$req[], getSequence) # retrieve the sequences
tabco <- lapply(seqs, uco) # compute codon frequences
tabco <- as.data.frame(lapply(tabco, as.vector), row.names = names(tabco[[1]])) # make the dataframe
names(tabco) <- liste$req[] # setup codon names
ca <- dudi.coa(tabco, scan = F, nf = 3) # perform the CA
s.label(ca$co, clabel = 0, sub = "Genes F1xF2 map") # plot Genes map
s.label(ca$li, sub = "Codons F1xF2 map") # plot codons map
Example 3
Here is a code example showing how an external data set can be used. You must use one of the
three data entry methods to provide data table X, and the PCA of this table will be computed.
X # check that the data table has been read correctly
pca1=dudi.pca(X,scan=F) # do the PCA of this table
scatter(pca1) # PCA biplot
s.corcircle(pca1$co) # PCA correlarion circle
s.label(pca1$li) # PCA row scores
score(pca1) # PCA canonical display : variables = f(principal components)
s.class(pca1$li, as.factor(substr(row.names(X),4,4)), col=c("black", "red", "green", "blue", "purple"))
External Data Entry
Paste a dataframe here :
Temp Flow pH Cond Oxyg Bdo5 Oxyd Ammo Nitr Phos
sp_1 10 41 8.5 295 110 2.3 1.4 0.12 3.40 0.11
sp_2 11 158 8.3 315 13 7.6 3.3 2.85 2.70 1.50
sp_3 11 198 8.5 290 113 3.3 1.5 0.40 4.00 0.10
sp_4 12 280 8.6 290 126 3.5 1.5 0.45 4.00 0.73
sp_5 13 322 8.5 285 117 3.6 1.6 0.48 4.60 0.84
sp_6 11 303 8.5 245 100 1.7 0.9 0.05 2.70 0.16
su_1 13 62 8.3 325 95 2.3 1.8 0.11 3.00 0.13
su_2 13 80 7.6 380 20 21.0 5.7 9.80 0.80 3.65
su_3 15 100 7.8 385 46 15.0 2.5 7.90 7.70 4.50
su_4 16 140 8.0 360 76 12.0 2.6 4.90 8.40 3.45
su_5 15 160 8.4 345 91 1.7 1.9 0.22 10.00 1.74
su_6 13 310 8.2 285 82 8.5 1.6 0.59 3.70 0.60
au_1 1 25 8.4 315 91 1.6 0.5 0.07 6.40 0.03
au_2 3 63 8.0 425 38 36.0 8.0 12.50 2.20 6.50
au_3 2 79 8.1 350 84 7.1 1.9 2.70 13.20 3.70
au_4 3 85 8.3 330 106 2.0 1.4 0.42 12.00 1.60
au_5 2 72 8.6 305 91 1.6 0.9 0.10 9.50 1.25
au_6 4 181 8.6 270 105 2.8 0.5 0.10 3.66 0.43
wi_1 3 118 8.0 325 100 1.6 1.2 0.17 1.80 0.19
wi_2 3 252 8.3 360 100 9.5 2.9 2.52 4.60 1.60
wi_3 3 315 8.3 370 100 8.7 2.8 2.80 4.80 2.85
wi_4 3 498 8.3 330 100 4.8 1.6 1.04 4.40 0.82
wi_5 2 390 8.2 330 100 1.7 1.2 0.56 5.00 0.60
wi_6 3 480 8.2 290 100 1.3 0.8 0.04 2.20 0.13
Or enter a dataset URL :
Or select a local file to submit:
Example 4
If you don't know how to program in R, here is a short code snippet that
shows you a little bit about what R can do.
x <- rnorm(100) # 100 random numbers from a normal(0,1) distribution
y <- exp(x) + rnorm(100) # an exponential function with error
result <- lsfit(x,y) # regress x on y and store the results
ls.print(result) # print the regression results
plot(x,y) # pretty obvious what this does
abline(result) # add the regression line to the plot
lines(lowess(x,y), col=2) # add a nonparametric regression line (a smoother)
hist(result$residuals) # histogram of the residuals from the regression
© 2004 Jean Thioulouse - Based on the Rweb system by Jeff Banfield.
© 1998 Jeff Banfield
Home Page
<www.math.montana.edu/~umsfjban>
Email
<jeff@math.montana.edu>
Last Modified: 11-Feb-2004