• Aucun résultat trouvé

Analysis of the iris Data

N/A
N/A
Protected

Academic year: 2022

Partager "Analysis of the iris Data"

Copied!
3
0
0

Texte intégral

(1)

Analysis of the iris Data

Created on \Sexpr{date()}

(Notice that the since the Sexpr was bolded, the result is bolded. Don't half-bold the

command, it will throw and error in R since xml and R code would be inter-mixed. This is also true of code chunks, so be careful how you copy and paste.)

<<loadLibs,echo=FALSE,results=hide>>=

# I usually load the libraries first so that any output produced by loading the library does not end up in the document

library(MASS) library(lattice) library(grid) data(iris)

@

To mimic the R documentation of the iris data,

This famous (Fisher's or Anderson's) iris data set gives the measurements in centimeters of the variables sepal length and width and petal length and width, respectively, for \Sexpr{dim(iris)[1]/3} flowers from each of

\Sexpr{length(levels(iris$Species))} species of iris. The species are

\Sexpr{paste(levels(iris$Species), collapse = ", ")}.

I like lists (not really). Here is a bulleted list of the species:

<<showOutputList,echo=FALSE,results=xml>>=

odfItemize(levels(iris$Species))

@

(2)

We can make a fancy plot of the data using lattice and insert that into the document.

<<irisSplom,echo=FALSE,results=hide, fig = TRUE>>=

trellis.par.set(col.whitebg(), warn = FALSE) out <- splom(iris[,-5],

groups = iris$Species, pscales = 0,

auto.key = list(columns = 3)) print(out)

@

We can also create a table of the correlation matrix for the virginica species:

<<corrTable,echo=FALSE,results=xml>>=

odfTable(

cor(iris[iris$Species == "virginica",-5]), digits = 3)

@

or show the means (ignoring species):

<<meanTable,echo=FALSE,results=xml>>=

irisMeans <- as.data.frame(lapply(iris[,-5], mean)) odfTable(

irisMeans,

useRowNames = FALSE, digits = 3)

@

Here is an example of changing the formatting within a table. Let's make the font red for the minimum mean value:

<<meanTable2,echo=FALSE,results=xml>>=

# get the styles that would be used

newStyles <- tableStyles(irisMeans, useRowNames = FALSE ,header = names(irisMeans))

# change the minimum mean cell text style. To see the list # of available styles, use getStyleDefs()

newStyles$text[,which.min(irisMeans)] <- "ArialHighlight"

odfTable(

irisMeans,

useRowNames = FALSE, digits = 3,

styles = newStyles)

@

To process this file, you might use:

library(odfWeave)

odfWeave("/path/to/simple.odt", "/path/to/output.odt")

(3)

and that produces the final odt file.

The following R packages were loaded when this analysis was run:

<<pkgList,echo=FALSE,results=xml>>=

odfTable(pkgVersions(type = "matrix"))

@

Références

Documents relatifs

Our results can reproduce experimental observations on fragment shapes, scaling of impact energy dependence and mass distributions, significantly improving our understan- ding of

Transgenic melon and squash expressing coat protein genes of aphid-borne viruses do not assist the spread of an aphid non-transmissible strain of cucumber mosaic virus in the

(1) The evolution of a growing dynamical length scale in the glassy phase of the model, and the consequent collapse of the distribution of local coarse-grained correlations measured

result, which we prove for general hyperbolic groups in the hope that some- body will find use for it, shows that the stable length extends to the space of currents:..

1) Case of three or less users: The SS-MC-MA system al- lows the allocation of a 528 MHz sub-band for each user. This system offers the same performance and advantages as MC- CDMA,

Parameters such as the mass or width of the W boson or triple-gauge-boson couplings are determined by comparing samples of Monte Carlo events to the data.. A reweighting procedure

28 find support for their hypothesis in the consequences of auditory deprivation on domain-general sequencing (i.e., impaired implicit learning for visual,

L’implication des partenaires nous amène à nous dépasser pour construire, avec eux, des milieux plus favorables à la participation des personnes présentant une DI ou un