

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Class: Statistical Analysis; Subject: Statistics; University: University of Illinois - Urbana-Champaign; Term: Unknown 1989;
Typology: Assignments
1 / 3
This page cannot be seen from the preview
Don't miss anything!


1.4 Use R as you would a calculator to find numeric answers to the following:
1 + 2(3 + 4)
43 + 32+
(4 + 3)(2 + 1)
2
Solutions
1 + 2 * (3 + 4) [1] 15
4^3 + 3^(2+1) [1] 91
sqrt((4+3)*(2+1)) [1] 4.
((1+2) / (3+4))^ [1] 0.
1.9 The asking price of unused MINI Coopers varies from seller to seller. An online classifieds listing has these values in thousands: 15.9 21.4 19.9 21.9 20.0 16.5 17.9 17.
Solutions
cooper <- c(15.9,21.4,19.9,21.9,20.0,16.5,17.9,17.5)
range(cooper) [1] 15.9 21.
mean(cooper) [1] 18.
range(cooper) - mean(cooper) [1] -2.975 3.
1.12 Create the following sequences:
using : seq(), or rep() as appropriate.
Solutions
rep("a", 5) [1] "a" "a" "a" "a" "a"
seq(1, 100, by=2) [1] 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 [24] 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 [47] 93 95 97 99
rep(c(1,2,3), c(3,3,3)) [1] 1 1 1 2 2 2 3 3 3
rep(c(1,2,3), c(3,2,1)) [1] 1 1 1 2 2 3
c(seq(1,5), seq(4,1)) [1] 1 2 3 4 5 4 3 2 1
1.23 For the data set treering, which contains tree-ring widths in dimensionless units, use an R function to answer the following:
Solutions
length(treering) [1] 7980
min(treering) [1] 0 which(treering == 0) [1] 1395
max(treering) [1] 1. which(treering == 1.908) [1] 2185
sum(treering > 1.5) [1] 219