Get the option number from the tutor to complete the tasks. Two data files are given. One is a document
with the extension .doc, the second is an Excel file.
My option is 4.
Import the data from .xlsx file.
Get the structure of the data frame obtained as a result of importing data from Excel (str(data)).
library(readxl)
## Warning: 'readxl' R 4.3.3
data1 <- read_excel("D://TSI//3rd course//Data Science Fundamentals//Data_part1_Pr1_Pr2.xlsx", sheet = 'Data4'
str(data1)
## tibble [100 x 2] (S3: tbl_df/tbl/data.frame)
## $ Failed: chr [1:100] "yes" "no" "no" "yes" ...
## $ Rate : chr [1:100] "1/402" "4/1881" "1/1196" "2/109" ...
Divide the rate/total variable into two columns: rate, total (separate()).
library(tidyr)
## Warning: 'tidyr' R 4.3.3
data1 <- separate(data1, col="Rate", into=c("Rate", "Total"), sep="/")
str(data1)
## tibble [100 x 3] (S3: tbl_df/tbl/data.frame)
## $ Failed: chr [1:100] "yes" "no" "no" "yes" ...
## $ Rate : chr [1:100] "1" "4" "1" "2" ...
## $ Total : chr [1:100] "402" "1881" "1196" "109" ...
Show the first 10 rows of the data frame (head()).…