Question 1:

Different class: Logical: contain three values TRUE, FALSE and NA Integer: Whole numbers (without a decimal point) Numeric: numbers may conatin a decimal Character: data used to represent string values.

Different data structures: Vector: can be further categorized into two main types: atomic vectors and lists. factors: employed to represent categorical data, allowing it to be stored and organized as distinct levels. tables: Tables closely resemble data frames and are frequently used for efficiently organizing and summarizing data, particularly when dealing with categorical variables. matrix: a two-dimensional array capable of holding numeric, character, or logical values. All elements within a matrix share the same data type. data frame: versatile data structures that can accommodate different data types, including numeric, factor, or character. list: objects that can store elements of diverse types, including numbers, strings, and vectors.

Question 2:

q2 <- sample(1:50,7)
q2
## [1] 37 15 49 48 40 21  3
R_StandardDeviation_InBuilt <- sd(q2)
R_StandardDeviation_InBuilt
## [1] 17.64329
R_StandardDeviation_Hand <- sqrt(sum((q2 - mean(q2))^2 ) / (length(q2)-1))
R_StandardDeviation_Hand
## [1] 17.64329

Question 3:

sd
## function (x, na.rm = FALSE) 
## sqrt(var(if (is.vector(x) || is.factor(x)) x else as.double(x), 
##     na.rm = na.rm))
## <bytecode: 0x0000000015d061c8>
## <environment: namespace:stats>
sd(q2)
## [1] 17.64329
StanderDeviation <- function(q2){
  StanderDeviation <- sqrt(sum((q2 - mean(q2))^2 ) / (length(q2)-1))
return(StanderDeviation)
       }
StanderDeviation(q2)
## [1] 17.64329
library(ggplot2)
library(psych)
## 
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
## 
##     %+%, alpha
library(moments)
## Warning: package 'moments' was built under R version 4.1.3
data("mtcars")
q4 <- ggplot(mtcars,aes(x=mpg)) + geom_density(color="red")
q4

skewness(mtcars)
##        mpg        cyl       disp         hp       drat         wt       qsec 
##  0.6404399 -0.1831287  0.4002724  0.7614356  0.2788734  0.4437855  0.3870456 
##         vs         am       gear       carb 
##  0.2519763  0.3817709  0.5546495  1.1021304

The skew as show above are majorty postive due to the number are mostly contain between -0.5 and 0.5