m=c("Juku", "Kati") p=c(180, 170) d=data.frame(m, p) d[d$p>175, ]$m #mtcars[mtcars$am==1, c("mpg", "cyl")] #length(mtcars[mtcars$mpg<15, ]$mpg) mean(mtcars$mpg) hist(mtcars$mpg) plot(mtcars$mpg, mtcars$qsec) x=seq(0, 20, 0.1) y=x*x-20*sin(x) plot(x, y, type='l', xlab="kiirus", ylab="energia", main="Seosed") abline(lm(y~x)) a=read.table("http://www.tlu.ee/~jaagup/5klass.txt", sep=",", header=TRUE) #order(a$pikkus) p=a[a$sugu=='m',] t=a[a$sugu=='n',] #a=a[a$pikkus>145,] #a=a[order(a$pikkus),] #barplot(a$pikkus) #plot(a$pikkus, a$mass) plot(p$pikkus, p$mass, col="blue") points(t$pikkus, t$mass, col="red") text(a$pikkus, a$mass-2, a$eesnimi) #abline(lm(a$mass~a$pikkus))