Welcome to the Simplilearn Community

Want to join the rest of our members? Sign up right away!

Sign Up

Data science with R( Sept 14 - Sept 30,2020)| Rahul

_89898

Member
I'm not able to type anything in R script in R studio Lab. When I click on script window, no cursor. Please help me.
 

Attachments

  • Screenshot 2020-09-14 at 9.13.41 AM.png
    Screenshot 2020-09-14 at 9.13.41 AM.png
    146 KB · Views: 21

Hitesh H S

Well-Known Member
Staff member
Simplilearn Support
I'm not able to type anything in R script in R studio Lab. When I click on script window, no cursor. Please help me.
Hi Learner,

I checked your lab and I can see you that you have coded and you are getting the output and there are no issue with the lab. In case you face any lab issue again. Please feel free to raise a ticket.

Thanks and Happy Learning !!
 

Sriraksha G

Well-Known Member
Staff member
Simplilearn Support
also i want to know more about how to post queries in community

Hey Karthik,

You have now posted a query on the community.
Please open the "Community" option on your LMS and type the link to the dedicated community thread to your batch

- You will find a text box at the bottom of the page where you can type your query

- Post this, please click on "Post Reply"

I hope this helps.
 

_89902

Member
Hello,

How are you all? I guess you all are doing great and I wish too of doing wonders.

I am new to this coding and I am facing lots of problems to understand the things. So anyone can suggest to me how to come across to it. I guess many of them had gone through this stage, so would you share your experience with me and other as well so that we can work likewise and get to it. Any suggestions will be appreciable.

Thank You
 
I am doing the Comcast customer service project. In that project trend chart for monthly and daily granularity levels is being asked. I think I can show a monthly trend. But how to get the daily trend? Should I make a daily trend for each month?
 
HI All... I have a doubt in the basics of statistics ... I know what mean , median mode , etc... is but i would like to know in terms of the data set what does a mean denote??? In the sense by getting the median for example what does the median say about the data.. Like wise what does the SD and Variance tell about the data ??? it would be really helpful if someone who have understood could explain since i am stuck there ... take care...
 
I tried to create a line trend of customer complaints in Comcast project and fetched the months in separate column. But when I tried plotting the same, the months are getting arranged in the alphabetical order. How do I correct the months to be sorted in a month-wise order
 

Trapti Jain

Active Member
I am facing error in doing below code, some one please check and help

barplot(counts, main = "car distri wrt gears",xlab = "#gears", ylab = "#cars", names=c("3gears", "4gears", "5 gears")
col = c("black", "green","red")

error
Error: unexpected symbol in:
"barplot(counts, main = "car distri wrt gears",xlab = "#gears", ylab = "#cars", names=c("3gears", "4gears", "5 gears")
col"
 

Hitesh H S

Well-Known Member
Staff member
Simplilearn Support
Hi,
The session 6 Recordings are not available.
Hi Karthik,

Please note that Day 6 recording is available under the name "session 7". Kindly download "Session 7" recording to view day 6 class.

I hope this helps you.

Happy Learning !!!
 

Raghavendra B M

Moderator
Staff member
Simplilearn Support
my completed classes are not showing up there under my profile

Hi Shruthi Rai_1,

I have checked your Learning Management System and I would like to inform you that 1 class = 1 full batch means once you have attended all the sessions of a particular batch it will reflect as 1 class attended.

Regards,
Team Simplilearn
 

_89994

New Member
Hey can someone point out my mistake. I was doing COMCAST project and got stuck at this point
>Create a new categorical variable with value as Open and Closed. Open & Pending is to be categorized as Open and Closed & Solved is to be categorized as Closed.
I tried the following code:
for (i in comcast_data$Status){
dplyr::mutate(comcast_data,New_1 = ifelse((i == 'Closed')||(i == 'Solved'),'Closed','Open'))
}
for (i in comcast_data$Status){
if ((i == 'Closed') || (i == 'Solved')){
comcast_data$New_Status = 'Close'
}else{
comcast_data$New_Status = 'Open'
}
}
I got the column named New_Status but in all the cells OPEN is comming.
can someone please suggest any other technique to do the same and why this code is not working
 

Flynn_1

Member
I have a question regarding the comcast project.

I created a code to try to answer the question below
Which complaint types are maximum i.e., around internet, network issues, or across any other domains.
- Create a new categorical variable with value as Open and Closed. Open & Pending is to be categorized as Open and Closed & Solved is to be categorized as Closed.

Could you tell me why the code is not working. I basically want to use the if statement to create a new column. I thought it would be simple but cannot figure out the solution. Thanks in advance


if (complaint$Status == "Open" |"Pending" )
{
complaint$Status_Category = "Open"
}else{
complaint$Status_Category = "Closed"
}

View(complaint)


 

Hitesh H S

Well-Known Member
Staff member
Simplilearn Support
I have a question regarding the comcast project.

I created a code to try to answer the question below
Which complaint types are maximum i.e., around internet, network issues, or across any other domains.
- Create a new categorical variable with value as Open and Closed. Open & Pending is to be categorized as Open and Closed & Solved is to be categorized as Closed.

Could you tell me why the code is not working. I basically want to use the if statement to create a new column. I thought it would be simple but cannot figure out the solution. Thanks in advance


if (complaint$Status == "Open" |"Pending" )
{
complaint$Status_Category = "Open"
}else{
complaint$Status_Category = "Closed"
}

View(complaint)
Hi Flynn,

You can use the following code
complaint_status = transform(telcom,FinalStatus = ifelse((Status=='Open'|Status=='Pending'),"Open","Closed"))

I hope this helps you.

Happy Learning!!!
 
How do we get the Pvalue in T-test in the biased and unbiased coin example....? where the value is 0.50,0.25, 0.125,0.0625,0.0325
 

Attachments

  • Query.jpg
    Query.jpg
    516.9 KB · Views: 16
  • Query.jpg
    Query.jpg
    516.9 KB · Views: 14

Flynn_1

Member
Hi Flynn,

You can use the following code
complaint_status = transform(telcom,FinalStatus = ifelse((Status=='Open'|Status=='Pending'),"Open","Closed"))

I hope this helps you.

Happy Learning!!!

Hi Hitesh, thank you. Is there a code that i can use that fits my code below. Since i find it easier to read the code this way

if (complaint$Status == "Open" |"Pending" )
{
complaint$Status_Category = "Open"
}else{
complaint$Status_Category = "Closed"
}

View(complaint)
 

Trapti Jain

Active Member
Guys I am facing an issue in installing packages, please check the below codes and error and help me out for same

install.packages("rpivotTable","esquisse")
library(rpivotTable)
library(esquisse)

Warning in install.packages :
'lib = "esquisse"' is not writable
Error in install.packages : unable to install packages
> install.packages("rpivotTable","esquisse")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
Warning in install.packages :
'lib = "esquisse"' is not writable
Error in install.packages : unable to install packages
> rpivotTable(airquality)
Error in rpivotTable(airquality) : could not find function "rpivotTable"

Thanks in advance
 

Hitesh H S

Well-Known Member
Staff member
Simplilearn Support
I am doing the Comcast customer service project. In that project trend chart for monthly and daily granularity levels is being asked. I think I can show a monthly trend. But how to get the daily trend? Should I make a daily trend for each month?
Hi Sasirekha,

PFB code for your reference
#Provide the trend chart for the number of complaints at monthly and daily granularity levels.
comcast_data$Date<- dmy(comcast_data$Date)
head(comcast_data)
monthly_count=arrange(summarise(group_by(comcast_data,month=as.integ er(month(Date))),Count=n()),month) daily_count=summarise(group_by(comcast_data,Date),Count=n())
monthly_count
daily_count
ggplot(data = monthly_count,aes(month,Count,label = Count))+ geom_line()+ geom_text()+ scale_x_continuous(breaks = monthly_count$month)+ labs(title = "Monthly Ticket Count",x= "Months",y ="No. of Tickets")
ggplot(data = daily_count,aes(as.POSIXct(Date),Count))+ geom_line()+ theme(axis.text.x = element_text(angle = 75))+ scale_x_datetime(breaks = "1 weeks",date_labels = "%d/%m")+ labs(title = "Daily Ticket Count",x= "Days",y ="No. of Tickets")

I hope this helps you.

Happy Learning!!
 

Hitesh H S

Well-Known Member
Staff member
Simplilearn Support
Guys I am facing an issue in installing packages, please check the below codes and error and help me out for same

install.packages("rpivotTable","esquisse")
library(rpivotTable)
library(esquisse)

Warning in install.packages :
'lib = "esquisse"' is not writable
Error in install.packages : unable to install packages
> install.packages("rpivotTable","esquisse")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
Warning in install.packages :
'lib = "esquisse"' is not writable
Error in install.packages : unable to install packages
> rpivotTable(airquality)
Error in rpivotTable(airquality) : could not find function "rpivotTable"

Thanks in advance
Guys I am facing an issue in installing packages, please check the below codes and error and help me out for same

install.packages("rpivotTable","esquisse")
library(rpivotTable)
library(esquisse)

Warning in install.packages :
'lib = "esquisse"' is not writable
Error in install.packages : unable to install packages
> install.packages("rpivotTable","esquisse")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
Warning in install.packages :
'lib = "esquisse"' is not writable
Error in install.packages : unable to install packages
> rpivotTable(airquality)
Error in rpivotTable(airquality) : could not find function "rpivotTable"

Thanks in advance
Hi Trapti,

The rpivotTable package depends on htmlwidgets package, so you need to install both packages.
install.packages('htmlwidgets', 'rpivotTable')
install.packages("esquisse")

Please try this and let me know if you're facing any error.

I hope this helps you.

Happy Learning !!
 
Hello,

How are you all? I guess you all are doing great and I wish too of doing wonders.

I am new to this coding and I am facing lots of problems to understand the things. So anyone can suggest to me how to come across to it. I guess many of them had gone through this stage, so would you share your experience with me and other as well so that we can work likewise and get to it. Any suggestions will be appreciable.

Thank You
Bro just do it. Type it, understand it and make it work.
 
Hi, I am having trouble completing the Comcast project. Can someone help me with the correct code of following part:
- Provide state wise status of complaints in a stacked bar chart. Use the categorized variable from Q3. Provide insights on: Which state has the maximum complaints
Which state has the highest percentage of unresolved complaints
- Provide the percentage of complaints resolved till date, which were received through theInternet and customer care calls.
 

Support Simplilearn(4685)

Moderator
Staff member
Alumni
Hi, I am having trouble completing the Comcast project. Can someone help me with the correct code of following part:
- Provide state wise status of complaints in a stacked bar chart. Use the categorized variable from Q3. Provide insights on: Which state has the maximum complaints
Which state has the highest percentage of unresolved complaints
- Provide the percentage of complaints resolved till date, which were received through theInternet and customer care calls.
Hi Primi,

please find the below code:

#Which state has the maximum complaints
statetab <- table(comcast$State,comcast$Status_New)
statetab <- cbind(statetab, Total = rowSums(statetab))
statetab

#Which state has the highest percentage of unresolved complaints
statetab<-data.frame(statetab) class(statetab)
statetab <- cbind(statetab, PercentUnr=statetab$Open/(statetab$Open+statetab$C losed)*100)
head(statetab)

#arranging unresolved in deceasing order
statetab<-statetab[order(statetab$PercentUnr,decreasing=TRUE),]
head(statetab)

Provide the percentage of complaints resolved till date, which were rece ived through theInternet and customer care calls
resolvedpercentage <- table(comcast$Received.Via, comcast$Status_New)
resolvedpercentage <- cbind(resolvedpercentage , Total = rowSums(resolvedpercentage ))
resolvedpercentage <-transform(resolvedpercentage ,PercentRes=Closed/Total*100,PercentUnr=Open /Total*100)
resolvedpercentage

I hope this helps you.

Happy Learning!!!
 
i am unable to excute the following code
df = iris %>% select(Sepal.Length,Species) %>% filter(Species=="versicolor" & Sepal.Length>5)
df

i am getting the following as the error
df = iris %>% select(Sepal.Length,Species) %>% filter(Species=="versicolor" & Sepal.Length>5)
Error in iris %>% select(Sepal.Length, Species) %>% filter(Species == :
could not find function "%>%"
 
Hi.
I have a doubt regarding plotting a line graph in the comcast project(project 2).

There is a question on creating a line graph.
"Provide the trend chart for the number of complaints at monthly and daily granularity levels.'
but the date given in the data is not in a proper format. How to make it in to dd-mm-yy format?
Then how can I add a variable to show complaints on daily and monthly basis?
Thank you
 
Last edited:
Hi

Can someone tell me how to upload data to R lab? I have been using R studio but it has crashed for some reason and now I need to switch to R lab for a while. Also how can I access R codes script from google drive in R lab?
 

Hitesh H S

Well-Known Member
Staff member
Simplilearn Support
How do we get the Pvalue in T-test in the biased and unbiased coin example....? where the value is 0.50,0.25, 0.125,0.0625,0.0325
Hi Mayank,

I have forwarded your query to the trainer. Trainer would be addressing your query within 3-4 days. Your patience is highly appreciated in this regard. However, you can ask this question to the trainer at the end of today's session and the trainer would explain to you about this.

Happy Learning !!!
 

Hitesh H S

Well-Known Member
Staff member
Simplilearn Support
Hi

Can someone tell me how to upload data to R lab? I have been using R studio but it has crashed for some reason and now I need to switch to R lab for a while. Also how can I access R codes script from google drive in R lab?
Hi Sreelakshmi,

Please find the attached screenshot for your reference.

I hope this helps you.

Happy Learning !!!
 

Attachments

  • R Lab.PNG
    R Lab.PNG
    127.2 KB · Views: 15

Hitesh H S

Well-Known Member
Staff member
Simplilearn Support
Hi.
I have a doubt regarding plotting a line graph in the comcast project(project 2).

There is a question on creating a line graph.
"Provide the trend chart for the number of complaints at monthly and daily granularity levels.'
but the date given in the data is not in a proper format. How to make it in to dd-mm-yy format?
Then how can I add a variable to show complaints on daily and monthly basis?
Thank you
Hi Sreelakshmi,

Please find the below code for your reference

#Provide the trend chart for the number of complaints at monthly and daily granularity levels.
comcast_data$Date<- dmy(comcast_data$Date)
head(comcast_data)

monthly_count=arrange(summarise(group_by(comcast_data,month=as.integ er(month(Date))),Count=n()),month)

daily_count=summarise(group_by(comcast_data,Date),Count=n())

monthly_count

daily_count

ggplot(data = monthly_count,aes(month,Count,label = Count))+ geom_line()+ geom_text()+ scale_x_continuous(breaks = monthly_count$month)+ labs(title = "Monthly Ticket Count",x= "Months",y ="No. of Tickets")

ggplot(data = daily_count,aes(as.POSIXct(Date),Count))+ geom_line()+ theme(axis.text.x = element_text(angle = 75))+ scale_x_datetime(breaks = "1 weeks",date_labels = "%d/%m")+ labs(title = "Daily Ticket Count",x= "Days",y ="No. of Tickets")

I hope this helps you.

Happy Learning !!!
 
Team, I tried mining the complaint variable of Comcast project by stemming and Termdocumentmatrix. At the end of it, i got 1143 records which are not sufficient to insert to the Comcast data which has 2224 records. Kindly help me in this .
 

Hitesh H S

Well-Known Member
Staff member
Simplilearn Support
i am unable to excute the following code
df = iris %>% select(Sepal.Length,Species) %>% filter(Species=="versicolor" & Sepal.Length>5)
df

i am getting the following as the error
df = iris %>% select(Sepal.Length,Species) %>% filter(Species=="versicolor" & Sepal.Length>5)
Error in iris %>% select(Sepal.Length, Species) %>% filter(Species == :
could not find function "%>%"
Hi Sarath,

You need to call "dplyr" library before using the function "%>%"

I hope this helps you.

Happy Learning !!!
 
Hi,

can someone help me in describing the complaint types from the complaint variable for the Comcast project.

Thanks,

Prasanna K
 

_89902

Member
ComcastData %>% group_by(Month) %>% summarize(NumofComplaints=n()) %>% arrange(desc(NumofComplaints= n()))

I am trying this code but results are not coming in descending order

A tibble: 12 x 2
Month NumofComplaints
<chr> <int>
1 Apr 375
2 Aug 67
3 Dec 65
4 Feb 59
5 Jan 55
6 Jul 49
7 Jun 1046
8 Mar 45
9 May 317
10 Nov 38
11 Oct 53
12 Sep 55

Please help
 
HI..

I have a doubt regarding the comcast project. The question to provide the frequency of the complaint types , i am using the word count but unable to know how many complaint types we are supposed to create. How to create the complaint types with its frequency???
 

Hitesh H S

Well-Known Member
Staff member
Simplilearn Support
Team, I tried mining the complaint variable of Comcast project by stemming and Termdocumentmatrix. At the end of it, i got 1143 records which are not sufficient to insert to the Comcast data which has 2224 records. Kindly help me in this .
Hi Prasanna,

You don't have to do TF - IDF here. You can use the following code here to identify the complaint types.

#Provide a table with the frequency of complaint types. #Which complaint types are maximum i.e., around internet, network issues, or across any other domains.
network_tickets=contains(comcast_data$CustomerComplaint,match='netwo rk',ignore.case = T)

internet_tickets=contains(comcast_data$CustomerComplaint,match = 'internet',ignore.case = T)

bill_tickets=contains(comcast_data$CustomerComplaint,match='bill',ig nore.case = T)

email_tickets=contains(comcast_data$CustomerComplaint,match="email", ignore.case = T)

charge_tickets=contains(comcast_data$CustomerComplaint,match='charge ',ignore.case = T)

comcast_data$ComplaintType[network_tickets]='Network' comcast_data$ComplaintType[internet_tickets]='Internet'

comcast_data$ComplaintType[bill_tickets]='Billing' comcast_data$ComplaintType[email_tickets]='Email'

comcast_data$ComplaintType[charge_tickets]='Charges'

comcast_data$ComplaintType[- c(network_tickets,internet_tickets,bill_tickets,email_tickets,charge _tickets)]="Others"

View(comcast_data)

table(comcast_data$ComplaintType)

I hope this helps you.

Thank you and Happy Learning !!!
 

N.RAMANAN

New Member
i am facing that my R markdown HTML file IS does not show out put results &,plotting . even its show programming code and its works in console but its does not show output results kindly me what to do???
 

Flynn_1

Member
Hi,

still on that comcast project and now i am trying the wordcloud that we learnt in class. However, the borrowed code from class doesn't help.
I tried looking up forums with no answer. Anyone have the answer

library(tm)
install.packages("tmap")
library(tmap)
detach(package:tm, unload=TRUE)
df3=complaint$Customer_Complaint
df3<- Corpus(df3)
inspect(df3)
toSpace <- content_transformer(function (x , pattern ) gsub(pattern, " ", x))
df3 <- tm_map(df3, toSpace, "@")
df3 <- tm_map(df3, toSpace, "-")
df3 <- tm_map(df3, toSpace, "@")
df3 <- tm_map(df3, toSpace, "/")
df3 <- tm_map(df3, toSpace, "!")
df3 <- tm_map(df3, toSpace, "?")
inspect(df3)


Regards,
Flynn
 
Top