HW3 familiar with R

HW3 familiar with R - m apply(m,1,sum) 1 apply(m,2,mean)...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
BioC 2808 HW3 familiar with R due 10 Dec., 2009 11:59pm Try issuing each of the R commands below in the order that they appear. After doing so and studying the resulting output, explain in words what each command or set of commands does. In some cases you may wish to try some other examples to make sure you understand the command. Q1 (5 pts) 1:12 c(9,5,3) x=c(1:6,9,5,3) x y=2*x-3 y y[2] y[-2] y[1:3] y[-(1:3)] sort(y) y m=matrix(y,nrow=3) m m[1,3] m[1,] m[,1] m[1:2,c(1,3)] m[,1]0 m[m[,1]0,] m=rbind(m,c(14,15,21))
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: m apply(m,1,sum) 1 apply(m,2,mean) plot(m[,1],m[,2]) plot(m[,1],m[,2],pch=16) plot(m[,1],m[,2],pch=16,col=4) lines(m[,1],m[,2],col=2) Q2 (5 pts) library(lattice) data(lattice) ?lattice require(stats) Depth <- equal.count(quakes$depth, number=8, overlap=.1) xyplot(lat ~ long | Depth, data = quakes) update(trellis.last.object(), strip = strip.custom(strip.names = TRUE, strip.levels = TRUE), par.strip.text = list(cex = 0.75), aspect = "iso")...
View Full Document

This note was uploaded on 07/29/2010 for the course BIOC BIOC2808 taught by Professor Dr.jjwang during the Fall '09 term at HKU.

Page1 / 2

HW3 familiar with R - m apply(m,1,sum) 1 apply(m,2,mean)...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online