Exercise 1
names | score |
---|---|
Bob | 34 |
Claire | 82 |
Luisa | 59 |
Matt | 72 |
Marta | 50 |
Mike | 100 |
- 'Bob'
- 'Claire'
- 'Luisa'
- 'Matt'
- 'Marta'
- 'Mike'
names | score1 | score2 |
---|---|---|
Bob | 34 | 64 |
Claire | 82 | 82 |
Luisa | 59 | 36 |
Matt | 72 | 48 |
Marta | 50 | 29 |
Mike | 100 | 85 |
- 34
- 82
- 59
- 72
- 50
- 100
- 64
- 82
- 36
- 48
- 29
- 85
The additional field for the second match score is created by adding score2<- c( , , , , , ), with values of the same length as previous. score2 was also added to the data.frame. Each field is accessed seperately by game_cards$fieldname fieldname:score1/ score2
Ecercise 2
names | match1 | match2 |
---|---|---|
Bob | 34 | 64 |
Claire | 82 | 82 |
Luisa | 59 | 36 |
Matt | 72 | 48 |
Marta | 50 | 29 |
Mike | 100 | 85 |
- 6
- 3
The minimum scores from match 1 and match 2 were 34 and 29 respectively.
The maximum scores from mathc 1 and match 2 were 100 and 85 respectively.
The minimum score from both matches was 29.
The maximum score from both mathes was 100
The minimum score from match 1 was 34, which was scored by Bob. The minimum score from match 2 was 29, which was scored by Marta.
The maximum score from match 1 was 100, which was scored by Mike. The maximum score from match 2 was 85, which was also scored by Mike.
names | match1 | match2 | |
---|---|---|---|
1 | Bob | 34 | 64 |
5 | Marta | 50 | 29 |
3 | Luisa | 59 | 36 |
4 | Matt | 72 | 48 |
2 | Claire | 82 | 82 |
6 | Mike | 100 | 85 |
names | match1 | match2 | |
---|---|---|---|
5 | Marta | 50 | 29 |
3 | Luisa | 59 | 36 |
4 | Matt | 72 | 48 |
1 | Bob | 34 | 64 |
2 | Claire | 82 | 82 |
6 | Mike | 100 | 85 |
The function order() arranges the sequence of numbers into an ascending order. order(game_cards$score) rearranges the scores of the matches on the game cards into a sequential order. The output is the ordered sequence of numbers.
The command plot() is used for generic X-Y graph plotting of R objects, through the use of command plot(x,y,...). x = the coordinates of points in the plot. y = the y co-ordinates in the plot. ... = arguments to be passed to the methods, such as graphical parameters. "type" = the type of plot that should be drawn, eg. "p" for points, "l" for lines, "b" for both etc. To add an overall title to the plot, add "main", to add a subtitle fot the plot, add "sub", to add a title for the x and y axis, add "xlab" and "ylab" respectively.
Error in barplot(game_cards$match1, names = game_cards$names): object 'game_cards' not found
Traceback:
1. barplot(game_cards$match1, names = game_cards$names)
Exercise 4
The par() command is used to set or query graphucal parameters. Parameters can be set by specifying them as arguments to par in tag = value form, or by passing them as a list of tagged values.
Exercise 5
Scatter plots are used to plot data points on a horizontal and vertical axis to show how much one variable is affected by another. It uses cartesian co-ordinates to display values for typically two variables of a set of data. A scatter plot can be used either when one continuous variable that is under the control of the experimenter and the other depends on it or when both continuous variables are independent. If a parameter exists that is systematically incremented and/or decremented by the other, it is called the control parameter or independent variable and is customarily plotted along the horizontal axis. The measured or dependent variable is customarily plotted along the vertical axis. If no dependent variable exists, either type of variable can be plotted on either axis and a scatter plot will illustrate only the degree of correlation (not causation) between two variables.
By plotting the values of a variable against itself, the resulting scatter plot shows the points falling along a straight line, with the line of best fit travelling directly through all points.
Exercise 6
Sepal.Length | Sepal.Width | Petal.Length | Petal.Width | Species |
---|---|---|---|---|
5.1 | 3.5 | 1.4 | 0.2 | setosa |
4.9 | 3.0 | 1.4 | 0.2 | setosa |
4.7 | 3.2 | 1.3 | 0.2 | setosa |
4.6 | 3.1 | 1.5 | 0.2 | setosa |
5.0 | 3.6 | 1.4 | 0.2 | setosa |
5.4 | 3.9 | 1.7 | 0.4 | setosa |
4.6 | 3.4 | 1.4 | 0.3 | setosa |
5.0 | 3.4 | 1.5 | 0.2 | setosa |
4.4 | 2.9 | 1.4 | 0.2 | setosa |
4.9 | 3.1 | 1.5 | 0.1 | setosa |
5.4 | 3.7 | 1.5 | 0.2 | setosa |
4.8 | 3.4 | 1.6 | 0.2 | setosa |
4.8 | 3.0 | 1.4 | 0.1 | setosa |
4.3 | 3.0 | 1.1 | 0.1 | setosa |
5.8 | 4.0 | 1.2 | 0.2 | setosa |
5.7 | 4.4 | 1.5 | 0.4 | setosa |
5.4 | 3.9 | 1.3 | 0.4 | setosa |
5.1 | 3.5 | 1.4 | 0.3 | setosa |
5.7 | 3.8 | 1.7 | 0.3 | setosa |
5.1 | 3.8 | 1.5 | 0.3 | setosa |
5.4 | 3.4 | 1.7 | 0.2 | setosa |
5.1 | 3.7 | 1.5 | 0.4 | setosa |
4.6 | 3.6 | 1.0 | 0.2 | setosa |
5.1 | 3.3 | 1.7 | 0.5 | setosa |
4.8 | 3.4 | 1.9 | 0.2 | setosa |
5.0 | 3.0 | 1.6 | 0.2 | setosa |
5.0 | 3.4 | 1.6 | 0.4 | setosa |
5.2 | 3.5 | 1.5 | 0.2 | setosa |
5.2 | 3.4 | 1.4 | 0.2 | setosa |
4.7 | 3.2 | 1.6 | 0.2 | setosa |
â‹® | â‹® | â‹® | â‹® | â‹® |
6.9 | 3.2 | 5.7 | 2.3 | virginica |
5.6 | 2.8 | 4.9 | 2.0 | virginica |
7.7 | 2.8 | 6.7 | 2.0 | virginica |
6.3 | 2.7 | 4.9 | 1.8 | virginica |
6.7 | 3.3 | 5.7 | 2.1 | virginica |
7.2 | 3.2 | 6.0 | 1.8 | virginica |
6.2 | 2.8 | 4.8 | 1.8 | virginica |
6.1 | 3.0 | 4.9 | 1.8 | virginica |
6.4 | 2.8 | 5.6 | 2.1 | virginica |
7.2 | 3.0 | 5.8 | 1.6 | virginica |
7.4 | 2.8 | 6.1 | 1.9 | virginica |
7.9 | 3.8 | 6.4 | 2.0 | virginica |
6.4 | 2.8 | 5.6 | 2.2 | virginica |
6.3 | 2.8 | 5.1 | 1.5 | virginica |
6.1 | 2.6 | 5.6 | 1.4 | virginica |
7.7 | 3.0 | 6.1 | 2.3 | virginica |
6.3 | 3.4 | 5.6 | 2.4 | virginica |
6.4 | 3.1 | 5.5 | 1.8 | virginica |
6.0 | 3.0 | 4.8 | 1.8 | virginica |
6.9 | 3.1 | 5.4 | 2.1 | virginica |
6.7 | 3.1 | 5.6 | 2.4 | virginica |
6.9 | 3.1 | 5.1 | 2.3 | virginica |
5.8 | 2.7 | 5.1 | 1.9 | virginica |
6.8 | 3.2 | 5.9 | 2.3 | virginica |
6.7 | 3.3 | 5.7 | 2.5 | virginica |
6.7 | 3.0 | 5.2 | 2.3 | virginica |
6.3 | 2.5 | 5.0 | 1.9 | virginica |
6.5 | 3.0 | 5.2 | 2.0 | virginica |
6.2 | 3.4 | 5.4 | 2.3 | virginica |
5.9 | 3.0 | 5.1 | 1.8 | virginica |
Exercise 7
Exercise 8
Expt | Run | Speed | |
---|---|---|---|
001 | 1 | 1 | 850 |
002 | 1 | 2 | 740 |
003 | 1 | 3 | 900 |
004 | 1 | 4 | 1070 |
005 | 1 | 5 | 930 |
006 | 1 | 6 | 850 |
007 | 1 | 7 | 950 |
008 | 1 | 8 | 980 |
009 | 1 | 9 | 980 |
010 | 1 | 10 | 880 |
011 | 1 | 11 | 1000 |
012 | 1 | 12 | 980 |
013 | 1 | 13 | 930 |
014 | 1 | 14 | 650 |
015 | 1 | 15 | 760 |
016 | 1 | 16 | 810 |
017 | 1 | 17 | 1000 |
018 | 1 | 18 | 1000 |
019 | 1 | 19 | 960 |
020 | 1 | 20 | 960 |
021 | 2 | 1 | 960 |
022 | 2 | 2 | 940 |
023 | 2 | 3 | 960 |
024 | 2 | 4 | 940 |
025 | 2 | 5 | 880 |
026 | 2 | 6 | 800 |
027 | 2 | 7 | 850 |
028 | 2 | 8 | 880 |
029 | 2 | 9 | 900 |
030 | 2 | 10 | 840 |
â‹® | â‹® | â‹® | â‹® |
71 | 4 | 11 | 910 |
72 | 4 | 12 | 920 |
73 | 4 | 13 | 890 |
74 | 4 | 14 | 860 |
75 | 4 | 15 | 880 |
76 | 4 | 16 | 720 |
77 | 4 | 17 | 840 |
78 | 4 | 18 | 850 |
79 | 4 | 19 | 850 |
80 | 4 | 20 | 780 |
81 | 5 | 1 | 890 |
82 | 5 | 2 | 840 |
83 | 5 | 3 | 780 |
84 | 5 | 4 | 810 |
85 | 5 | 5 | 760 |
86 | 5 | 6 | 810 |
87 | 5 | 7 | 790 |
88 | 5 | 8 | 810 |
89 | 5 | 9 | 820 |
90 | 5 | 10 | 850 |
91 | 5 | 11 | 870 |
92 | 5 | 12 | 870 |
93 | 5 | 13 | 810 |
94 | 5 | 14 | 740 |
95 | 5 | 15 | 810 |
96 | 5 | 16 | 940 |
97 | 5 | 17 | 950 |
98 | 5 | 18 | 800 |
99 | 5 | 19 | 810 |
100 | 5 | 20 | 870 |
Exercise 9
- 850
- 740
- 900
- 1070
- 930
- 850
- 950
- 980
- 980
- 880
- 1000
- 980
- 930
- 650
- 760
- 810
- 1000
- 1000
- 960
- 960
- 960
- 940
- 960
- 940
- 880
- 800
- 850
- 880
- 900
- 840
- 830
- 790
- 810
- 880
- 880
- 830
- 800
- 790
- 760
- 800
- 890
- 810
- 810
- 820
- 800
- 770
- 760
- 740
- 750
- 760
- 910
- 920
- 890
- 860
- 880
- 720
- 840
- 850
- 850
- 780
- 890
- 840
- 780
- 810
- 760
- 810
- 790
- 810
- 820
- 850
- 870
- 870
- 810
- 740
- 810
- 940
- 950
- 800
- 810
- 870
Ecercise 10
Exercise 11
- -1.32983839753494
- -0.442650500019424
- 1.62417390000007
- -1.67584448879818
- -1.22606692573905
- -1.19288617284262
- -1.89831059193453
- -0.715139088553884
- 1.07456486955929
- 1.38397130820677
- -0.594388635345226
- -1.15802346922851
- -1.51839543038494
- 0.974198551046387
- -0.955640119728177
- 0.894749513314877
- 1.72258460789887
- 0.612603626517112
- 1.41000194006057
- -0.0923231473325155
- -1.19137273591046
- -0.0901615856822621
- 0.198453244443982
- 0.76199937209954
- 0.273573214989069
- 0.0793028237723885
- -0.903510855037117
- -0.230321581796134
- -0.001180156462322
- -1.2701468849564
- -0.767412117905502
- -0.827985224767165
- -0.328776093812234
- 2.15043910397576
- 1.06180959667687
- 0.488887253257983
- -0.074941805342632
- 2.35558044249208
- -0.443076174694343
- 1.0869397433374
- 1.44632130461307
- 0.367796447248661
- 0.0241548061108222
- -0.828092892936713
- 0.790879343064088
- 0.586053077078761
- -1.60339751167525
- 0.481270772574882
- -0.121348176146382
- -0.393060711498406
- 2.43608140942002
- 1.8347063468031
- -2.26323120859589
- -0.0993808424205221
- -0.173495819812754
- -0.759511800114655
- -1.29239201507555
- 1.33220449431244
- -0.409402931595105
- 1.22006169606042
- 1.06758646263697
- -1.37302824574217
- -0.299992926985538
- -0.254254005922695
- 0.453610218093153
- -1.23159422338585
- 0.932072541036467
- 0.250752012760951
- 0.536277896231289
- 1.19309516838348
- -1.66467505248656
- 0.667111423406191
- -1.04942883115995
- -2.19346290160825
- -1.80496773927251
- -0.985561800397227
- 1.39745986921433
- -0.886809714104144
- 1.57835996235896
- 0.808882415910302
- 0.519870065363074
- 1.32123018847284
- 0.97851483774372
- -0.037514536486098
- -0.658181238838866
- -0.212091917063404
- 0.117860816075992
- -1.39473895379265
- -0.618698184711007
- -0.560472912953385
- -0.399376178911394
- 0.0167280955025305
- 1.19744591607392
- -0.0569608776567713
- 0.617217164472841
- 0.318102254568782
- 0.139614057023832
- -0.736671158674166
- -1.31446190001575
- 0.194511032191064
- 0.264518806245178
- 0.582811257336289
- 0.42062978236936
- 0.537996992468834
- 0.754302130779251
- 0.0922018121927977
- 0.681373225292191
- 0.798066514078528
- 0.232842233264819
- 0.641004926059395
- 0.244015408214182
- 0.570152970496565
- 0.811254309955984
- 0.798563710646704
- 0.24969592015259
- 0.136332410154864
- 0.0474268107209355
- 0.288467477541417
- 0.385370008647442
- 0.996502695605159
- 0.183566161431372
- 0.672800717642531
- 0.0643984866328537
- 0.620991089148447
- 0.834634169237688
- 0.253943306626752
- 0.967401105212048
- 0.520939820446074
- 0.620963342254981
- 0.437164880800992
- 0.800008459249511
- 0.784856268204749
- 0.753692883765325
- 0.206868261331692
- 0.470573494676501
- 0.514903036179021
- 0.713916168548167
- 0.0855489911045879
- 0.208472222089767
- 0.555995153728873
- 0.863345834659413
- 0.423687194706872
- 0.476202831370756
- 0.407577888807282
- 0.49562520859763
- 0.075463596964255
- 0.339054282521829
- 0.200695814564824
- 0.00622879504226148
- 0.787927633151412
- 0.951467270264402
- 0.918116616783664
- 0.627712194342166
- 0.727811112068594
- 0.243230506079271
- 0.678512015379965
- 0.717459577368572
- 0.764501367462799
- 0.528164511080831
- 0.602822620421648
- 0.926245340844616
- 0.722419350873679
- 0.348279399331659
- 0.649060261901468
- 0.326362984254956
- 0.155253336299211
- 0.140495303319767
- 0.349665948189795
- 0.57015626761131
- 0.649660609895363
- 0.454423484858125
- 0.866482872748747
- 0.401366396341473
- 0.187020024983212
- 0.869719553273171
- 0.252253205049783
- 0.791618789546192
- 0.0038271879311651
- 0.218274709302932
- 0.190541617572308
- 0.859617992537096
- 0.492092164233327
- 0.306638536509126
- 0.786544287344441
- 0.9585007710848
- 0.163091869559139
- 0.700145638082176
- 0.471447916468605
- 0.314486169489101
- 0.596971365157515
- 0.306181581923738
- 0.522562241414562
- 0.919712348375469
- 0.187213698634878
- 0.057803800329566
- 0.0254174668807536
- 0.427565331803635
- 0.278308807173744
- 0.911951158428565
- 0.794001728529111
Error in rbinom(morley$Speed): argument "size" is missing, with no default
Traceback:
1. rbinom(morley$Speed)
Exercise 12
There is not a significant difference between the results of experiment 1 and 2, as p>0.05.
There is a significance difference between the results of experiment 1 and 4, as p<0.05
There is a significant difference between the results of experiment 1 and 5, as p<0.05.
There is not a significant difference between the results of experiment 2 and 4 because p>0.05.
There is not a significant difference between the results of experiment 2 and 5, as p>0.05.
There is not a significant difference between the results of experiment 4 and 5 because p>0.05.