Conceptual Questions

“Question: What is meant by the term named list” “Answer: named list is a special list that can be created within the list function to bring out only the elements requested from the entire list.”

“Question:What is a delimiter in a raw data file” “Answer:delimiter is a character that separates the data values in the raw data file.”

Programming Questions

load the readr package and access the URL file for the data

##We are naming our data file Jagritdata
Jagritdata <- read_csv("https://www4.stat.ncsu.edu/~online/ST308/Data/jtulsya_yeast.csv")

##Now, we pull the mit variable from the tibble using the $ function
Jagritdata$mit
##   [1] 0.14 0.09 0.09 0.14 0.15 0.26 0.35 0.18 0.63 0.10 0.36 0.21 0.28 0.41 0.16
##  [16] 0.23 0.18 0.13 0.34 0.18 0.18 0.17 0.38 0.31 0.20 0.15 0.39 0.25 0.29 0.15
##  [31] 0.19 0.15 0.17 0.29 0.09 0.16 0.15 0.08 0.26 0.32 0.25 0.19 0.19 0.33 0.47
##  [46] 0.46 0.24 0.32 0.19 0.28 0.61 0.31 0.08 0.80 0.21 0.20 0.36 0.17 0.13 0.25
##  [61] 0.27 0.15 0.20 0.15 0.18 0.13 0.37 0.15 0.18 0.18 0.25 0.52 0.17 0.12 0.00
##  [76] 0.30 0.20 0.21 0.34 0.44 0.49 0.70 0.12 0.42 0.31 0.22 0.24 0.21 0.26 0.10
##  [91] 0.14 0.41 0.16 0.40 0.29 0.19 0.18 0.36 0.28 0.14 0.33 0.65 0.32 0.14 0.61
## [106] 0.13 0.35 0.28 0.17 0.40 0.14 0.28 0.19 0.19 0.12 0.38 0.41 0.13 0.25 0.09
## [121] 0.16 0.28 0.20 0.14 0.10 0.19 0.29 0.15 0.08 0.39 0.42 0.16 0.22 0.30 0.48
## [136] 0.21 0.11 0.18 0.12 0.40 0.60 0.24 0.14 0.13 0.37 0.17 0.17 0.16 0.53 0.24
## [151] 0.31 0.17 0.36 0.24 0.65 0.43 0.47 0.17 0.32 0.20 0.30 0.28 0.12 0.17 0.30
## [166] 0.49 0.45 0.87 0.28 0.40 0.56 0.19 0.25 0.52 0.15 0.18 0.23 0.10 0.25 0.53
## [181] 0.24 0.17 0.26 0.21 0.15 0.45 0.36 0.18 0.31 0.11 0.18 0.11 0.23 0.47 0.37
## [196] 0.34 0.11 0.21 0.16 0.41 0.25 0.65 0.62 0.23 0.11 0.35 0.23 0.11 0.53 0.36
## [211] 0.22 0.18 0.17 0.23 0.20 0.19 0.24 0.21 0.40 0.65 0.28 0.36 0.16 0.20 0.18
## [226] 0.21 0.19 0.13 0.21 0.32 0.52 0.14 0.25 0.16 0.36 0.27 0.13 0.21 0.18 0.29
## [241] 0.33 0.22 0.10 0.23 0.37 0.08 0.19 0.17 0.43 0.15 0.40 0.49 0.49 0.13 0.67
## [256] 0.12 0.41 0.13 0.26 0.65 0.42 0.11 0.14 0.28 0.19 0.54 0.00 0.23 0.13 0.13
## [271] 0.08 0.41 0.25 0.46 0.13 0.28 0.17 0.08 0.25 0.27 0.28 0.23 0.18 0.48 0.38
## [286] 0.15 0.32 0.17 0.12 0.25 0.17 0.15 0.16 0.34 0.37 0.61 0.18 0.51 0.22 0.27
## [301] 0.29 0.21 0.43 0.27 0.52 0.19 0.26 0.45 0.13 0.17 0.21 0.39 0.16 0.35 0.18
## [316] 0.14 0.15 0.23 0.13 0.15 0.18 0.23 0.17 0.19 0.19 0.17 0.18 0.26 0.29 0.34
## [331] 0.40 0.13 0.26 0.30 0.21 0.13 0.42 0.22 0.25 0.24 0.14 0.25 0.28 0.28 0.35
## [346] 0.17 0.16 0.14 0.22 0.23 0.09 0.28 0.19 0.29 0.52 0.27 0.20 0.15 0.22 0.26
## [361] 0.18 0.18 0.58 0.12 0.18 0.12 0.17 0.16 0.24 0.19 0.14 0.16 0.13 0.21 0.55
## [376] 0.20 0.29 0.12 0.55 0.28 0.36 0.71 0.30 0.28 0.21 0.27 0.13 0.28 0.12 0.15
## [391] 0.67 0.21 0.50 0.42 0.28 0.29 0.24 0.19 0.06 0.20 0.47 0.27 0.12 0.34 0.56
## [406] 0.22 0.56 0.70 0.27 0.29 0.27 0.18 0.52 0.37 0.28 0.53 0.34 0.27 0.13 0.28
## [421] 0.43 0.51 0.51 0.19 0.14 0.32 0.19 0.25 0.18 0.15 0.14 0.47 0.26 0.37 0.16
## [436] 0.60 0.29 0.13 0.23 0.44 0.54 0.13 0.30 0.30 0.34 0.64 0.16 0.44 0.16 0.38
## [451] 0.18 0.22 0.19 0.16 0.24 0.20 0.29 0.35 0.18 0.52 0.26 0.19 0.12 0.18 0.22
## [466] 0.16 0.21 0.34 0.19 0.14 0.27 0.12 0.20 0.36 0.25 0.16 0.18 0.27 0.18 0.18
## [481] 0.49 0.17 0.52 0.51 0.11 0.21 0.20 0.27 0.12 0.22 0.28 0.12 0.46 0.19 0.13
## [496] 0.15 0.19 0.16 0.26 0.18 0.33 0.22 0.24 0.18 0.27 0.28 0.12 0.19 0.17 0.16
## [511] 0.33 0.61 0.80 0.14 0.18 0.50 0.19 0.12 0.10 0.14 0.12 0.19 0.13 0.25 0.31
## [526] 0.46 0.54 0.47 0.28 0.45 0.19 0.26 0.18 0.19 0.14 0.30 0.30 0.08 0.36 0.31
## [541] 0.17 0.33 0.37 0.23 0.17 0.15 0.20 0.17 0.22 0.20 0.30 0.15 0.26 0.24 0.19
## [556] 0.21 0.15 0.26 0.14 0.18 0.13 0.11 0.40 0.22 0.44 0.37 0.17 0.48 0.29 0.62
## [571] 0.26 0.30 0.40 0.16 0.20 0.09 0.28 0.17 0.16 0.07 0.19 0.18 0.19 0.18 0.15
## [586] 0.21 0.21 0.50 0.30 0.86 0.19 0.17 0.20 0.13 0.40 0.19 0.27 0.21 0.18 0.12
## [601] 0.27 0.17 0.33 0.40 0.47 0.18 0.17 0.70 0.38 0.29 0.25 0.35 0.21 0.25 0.17
## [616] 0.16 0.51 0.30 0.27 0.20 0.22 0.16 0.30 0.12 0.19 0.21 0.18 0.43 0.14 0.27
## [631] 0.38 0.31 0.24 0.29 0.18 0.20 0.58 0.26 0.33 0.15 0.12 0.16 0.28 0.44 0.18
## [646] 0.41 0.19 0.19 0.44 0.36 0.18 0.12 0.17 0.19 0.13 0.47 0.37 0.21 0.11 0.16
## [661] 0.29 0.21 0.31 0.16 0.12 0.22 0.17 0.13 0.52 0.30 0.26 0.23 0.35 0.14 0.19
## [676] 0.26 0.10 0.11 0.33 0.58 0.29 0.25 0.20 0.15 0.21 0.19 0.22 0.56 0.30 0.35
## [691] 0.36 0.37 0.60 0.18 0.65 0.22 0.23 0.20 0.30 0.19 0.27 0.14 0.10 0.48 0.36
## [706] 0.34 0.44 0.09 0.12 0.28 0.12 0.31 0.10 0.57 0.26 0.49 0.23 0.25 0.26 0.28
## [721] 0.14 0.19 0.35 0.19 0.12 0.62 0.24 0.16 0.22 0.20 0.28 0.34 0.15 0.34 0.33
## [736] 0.25 0.31 0.13 0.22 0.21 0.17 0.26
##We name the mit column as mitdata
mitdata<-Jagritdata$mit

##Now, we are going to find the mean of mitdata using the mean function
mean(mitdata, na.rm = TRUE)
## [1] 0.2646765
##Read in Bupa data from local source
read_tsv("/Users/jagrittulsyan/Downloads/jtulsya_bupa.tsv")
## # A tibble: 171 × 5
##     `34`  `36`  `91`   `2`  `78`
##    <dbl> <dbl> <dbl> <dbl> <dbl>
##  1    33    28    98     1    58
##  2    18    22   101     2    65
##  3    19    42    90     1    80
##  4    25     5    90     1    60
##  5    19    13   103     2    75
##  6    24    38    89     2    63
##  7    23    12    88     1    56
##  8    29    18    88     2    46
##  9    24    11    85     2    64
## 10    45    85    90     2    63
## # ℹ 161 more rows
##Naming the Bupa data as Bupadata
Bupadata <- read_tsv("/Users/jagrittulsyan/Downloads/jtulsya_bupa.tsv")

##Renaming the column names according to the variables given in the question using the colnames function
colnames(Bupadata) <- c("sgpt","gammagt","mcv","selector","alkphos")
colnames(Bupadata)
## [1] "sgpt"     "gammagt"  "mcv"      "selector" "alkphos"
print(Bupadata,n=10)
## # A tibble: 171 × 5
##     sgpt gammagt   mcv selector alkphos
##    <dbl>   <dbl> <dbl>    <dbl>   <dbl>
##  1    33      28    98        1      58
##  2    18      22   101        2      65
##  3    19      42    90        1      80
##  4    25       5    90        1      60
##  5    19      13   103        2      75
##  6    24      38    89        2      63
##  7    23      12    88        1      56
##  8    29      18    88        2      46
##  9    24      11    85        2      64
## 10    45      85    90        2      63
## # ℹ 161 more rows
##Load the readxl package and the file from the local source
options(repos = "https://cloud.r-project.org")
install.packages("readxl")
## 
## The downloaded binary packages are in
##  /var/folders/qf/h08p01lj6193h5sf5b8590pc0000gn/T//RtmpnyTT0R/downloaded_packages
library(readxl)
read_excel("/Users/jagrittulsyan/Downloads/jtulsya_abalone.xlsx")
## # A tibble: 2,088 × 5
##    Sex   Length WholeWeight Diameter Rings
##    <chr>  <dbl>       <dbl>    <dbl> <dbl>
##  1 F      0.64        1.38     0.525     9
##  2 I      0.34        0.18     0.255     6
##  3 M      0.52        0.58     0.4       8
##  4 M      0.615       1.29     0.495    11
##  5 M      0.555       0.837    0.455     9
##  6 I      0.44        0.435    0.35     12
##  7 F      0.66        1.68     0.52     17
##  8 I      0.56        0.832    0.445     9
##  9 F      0.645       1.29     0.55     14
## 10 I      0.32        0.183    0.235     7
## # ℹ 2,078 more rows
abalone <- read_excel("/Users/jagrittulsyan/Downloads/jtulsya_abalone.xlsx")

##Create a subset of the abalone data to just show the first 5 rows of the data along with only the second column using the square brackets
subset_abalone <- abalone[1:5,2]
subset_abalone
## # A tibble: 5 × 1
##   Length
##    <dbl>
## 1  0.64 
## 2  0.34 
## 3  0.52 
## 4  0.615
## 5  0.555