The uploaded file is the one that I received from the expert.Based on the code Task B and C, I want to make the chart/graph.It would be better to get it such as the Bar graph or Scatter plot with some...

1 answer below »
The uploaded file is the one that I received from the expert.Based on the code Task B and C, I want to make the chart/graph.It would be better to get it such as the Bar graph or Scatter plot with some explanation.
Answered Same DayAug 15, 2021

Answer To: The uploaded file is the one that I received from the expert.Based on the code Task B and C, I want...

Naveen answered on Aug 15 2021
146 Votes
# Required packages are loading
library(janitor)
library(lubridate)
library(plyr)
library(ggplot2)
library(dplyr)
# Reading data file
data <- read.table("assignment1.txt", s
ep="\t", header = TRUE)
# Print top six records
head(data)
# Checking the dimension
dim(data)
## Task-A
# Removing the missing values
data_surveyed <- data[!is.na(data$satis_survey),]
# Printing the frequenct table contains counts and percentages of each survey
data_surveyed %>% tabyl(satis_survey, sort = TRUE)
# Changing the date format of survey_date column
data_surveyed = data_surveyed %>% mutate(survey_date = as.Date(survey_date,format = "%m/%d/%Y"))
# Print first six values in survey_date column
head(data_surveyed$survey_date)
# Inserting month column
data_surveyed[['Month']]<-month(data_surveyed$survey_date,label = T)
# Print first six values from Month column
head(data_surveyed$Month)
# Inserting counts column for our use
data_surveyed$counts<-1
# Printing all of the count of surveys by month
Part_A <- aggregate(data_surveyed["counts"], by = data_surveyed["Month"], FUN = sum)
Part_A
## Task-B
# Removing the missing values in each column
customers <- data_surveyed[!is.na(data_surveyed$total_investments),]
customers <- customers[!is.na(customers$cust_age),]
customers <- customers[!is.na(customers$cust_tenure),]
customers <- customers[!is.na(customers$tottrans),]
# Removing negative values in each column (Step by Step)
Customers <- customers[data_surveyed$total_investments>0,]
Customers <- Customers[Customers$cust_age>0,]
Customers <- Customers[Customers$cust_tenure>0,]
Customers <- Customers[Customers$tottrans>0,]
# Checking & removing NA values is there any produced after removing negative values
sum(is.na(Customers))
Customers = na.omit(Customers)
# print top six...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here