One of the kickoff steps of information analysis is the descriptive analysis; this helps to sympathise how the information is distributed in addition to provides of import information for farther steps. This gear upward of exercises volition include functions useful for 1 variable descriptive analysis, including graphs. Before proceeding, it powerfulness hold upward helpful to await over the assist pages for the
length, range, median, IQR
, hist
, quantile
, boxplot
, and stem
functions. For this gear upward of exercises you lot volition utilisation a dataset called
islands
, an R dataset that contains the areas of the world’s major landmasses expressed inwards squared miles. To charge the dataset run the next instruction: data(islands)
. Answers to the exercises are available here.
If you lot obtained a unlike (correct) respond than those listed on the solutions page, delight experience complimentary to post service your respond every bit a comment on that page.
Exercise 1
Load the
islands
dataset in addition to obtain the full position out of observations. Exercise 2
Measures of primal tendency. Obtain the next statistics of islands
a)Mean
b)Median
b)Median
Exercise 3
Using the function
range
, obtain the next values: a)Size of the biggest island
b)Size of the smallest island
b)Size of the smallest island
Exercise 4
Measures of dispersion. Find the next values for islands:
a)Standard deviation
b)The gain of the islands size using the function
b)The gain of the islands size using the function
range
. Exercise 5
Quantiles. Using the function
quantile
obtain a vector including the next quantiles: a) 0%, 25%, 50%, 75%, 100%
b) .05%, 95%
b) .05%, 95%
Exercise 6
Interquartile range. Find the interquartile gain of islands.
Exercise 7
Create an histogram of islands alongside the next properties.
a) Showing the frequency of each group
b) Showing the proportion of each group
b) Showing the proportion of each group
Exercise 8
Create box-plots alongside the next conditions
a) Including outiers
b) Without outliers
b) Without outliers
Exercise 9
Using the function
boxplot
find the outliers of islands. Hint: utilisation the argument prob=F
. Exercise 10
Create a stalk in addition to foliage plot of islands
___________________________________
Below are the solutions to these exercises on Examining data.
#################### # # # Exercise 1 # # # #################### data(islands) length(islands)
## [1] 48
#################### # # # Exercise ii # # # #################### mean(islands)
## [1] 1252.729
median(islands)
## [1] 41
#################### # # # Exercise three # # # #################### range(islands)[1]
## [1] 12
range(islands)[2]
## [1] 16988
#################### # # # Exercise four # # # #################### sd(islands)
## [1] 3371.146
range(islands)[2] - range(islands)[1]
## [1] 16976
#################### # # # Exercise v # # # #################### quantile(islands)
## 0% 25% 50% 75% 100% ## 12.00 20.50 41.00 183.25 16988.00
quantile(islands, c(.05,.95))
## 5% 95% ## 13.00 8481.75
#################### # # # Exercise vi # # # #################### IQR(islands)
## [1] 162.75
#################### # # # Exercise vii # # # #################### hist(islands)
hist(islands,prob=T)
#################### # # # Exercise 8 # # # #################### boxplot(islands)
boxplot(islands, outline = F)
#################### # # # Exercise ix # # # #################### boxplot(islands, plot=F)$out
## Africa Antarctica Asia Commonwealth of Australia Europe ## 11506 5500 16988 2968 3745 ## Greenland North America South America ## 840 9390 6795
#################### # # # Exercise 10 # # # #################### stem(islands)
## ## The decimal signal is three digit(s) to the right of the | ## ## 0 | 00000000000000000000000000000111111222338 ## ii | 07 ## four | v ## vi | 8 ## 8 | four ## 10 | v ## 12 | ## xiv | ## xvi | 0
Sources:
http://www.r-exercises.com/2016/09/06/examining-data/http://www.r-exercises.com/2016/09/06/examining-data-solutions/