In: Computer Science
How do you load a simple data series onto R? For instance, data values that are down below:
Below are the batting averages of 20 batting champions of the National League:
0.403 0.378 0.320 0.341 0.362 0.334 0.379 0.424 0.326 0.330 0.345 0.354 0.350 0.330 0.376 0.363 0.353 0.351 0.335 0.371
1. Construct a relative frequency histogram for the data.
2. What can you say about the shape of the histogram (modes, symmetry, outliers)?
How to load the series data in R?
Before we start, we first need to have data. The data can be saved in excel,SPSS or some other file type. When you svaed your data in a file you can add,change or edit the data whenever you want.
Before you load the data , we can check all constraints that satisfy. They are
?
, $
,%
, ^
,
&
, *
, (
,
)
,-
,#
,
?
,,
,<
,>
,
/
, |
, \
, [
,]
,{
, and }
;NA
.1. Construct a relative frequency histogram for the data.
Given the series is 0.403 0.378 0.320 0.341 0.362 0.334 0.379 0.424 0.326 0.330 0.345 0.354 0.350 0.330 0.376 0.363 0.353 0.351 0.335 0.371
The sorted data is:0.320 0.326 0.330 0.330 0.334 0.335 0.341 0.345 0.350 0.351 0.353 0.354 0.362 0.363 0.371 0.376 0.378 0.379 0.403 0.424
If we start at0.3, and end at4.25, we can construct 5 classes of width0.25.
Theseclasses will include all the observations, and the first and last classes won’t be empty.
Class Frequency Relative frequency 0.3<=x<0.325 1 0.25
0.325<=x<0.350 7 0.35
0.350<=x<0.375 7 0.35
0.375<=x<4.00 3 0.15
4.00<=x<4.25 2 0.10
The below diagram is the relative frequency histogram
X-axis the relative frequency and y-axis is the frequency.
2. What can you say about the shape of the histogram (modes, symmetry, outliers)?
A. The histogram is unimodal and roughly symmetric around 0.35. There do not appear to be any outliers.