########### # Blatt 1 # ########### #Aufgabe 1 #a data(hills) attach(hills) head(hills) summary(hills) row.names(hills) ?hills #b hills[which(time == time[(rank(time) == 30)]),] hills[which(time == time[(rank(time) == 3)]),] #c x<-rep(0,35) x<-dist/time x hills[which(x == min(x)),] hills[which(x == max(x)),] hills["Moffat Chase",] hills["Moffat Chase",1] / hills["Moffat Chase",2] rank(x) #Aufgabe 2 #a data(tips) attach(tips) head(tips) summary(tips) ?tips #b mean(total_bill) sd(total_bill) range(total_bill) hist(total_bill) table(sex, smoker) table(day, time) #c size[total_bill == max(total_bill)] size[which(total_bill == max(total_bill))] plot(size, total_bill, pch = 20) points(size[total_bill == max(total_bill)], total_bill[total_bill == max(total_bill)], col = "red", pch = 20) #d mean(size) mean(size[day == "Fri" ]) #e plot(total_bill, tip, pch = 20, main = "Gesamtbetrag gegen Trinkgeld") tip_pc<-tip/total_bill plot(total_bill, tip_pc, pch = 20, main = "Gesamtbetrag gegen Anteil des Trinkgeldes", ylab = "Trinkgeld in Prozent") points(total_bill[tip_pc > 0.5], tip_pc[tip_pc > 0.5], col = "red", pch = 20) #f barplot(table(time), ylim = c(0,200), col = c(4,6), main = "Saeulendiagramm von Time") #Aufgabe 3 simu<-rbinom(1000,10,0.25) table(simu) barplot(table(simu)) barplot(table(simu)) lines(1000 * (dbinom(0:10, 10, 0.25)))