Welcome to the Simplilearn Community

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

Sign Up

Data science with R( Nov 7th - Dec 13th,2020)| Rahul A

ranatarannum

Member
Alumni
Arthritis$categories=ifelse(Arthritis$Treatment=="Treated" && Arthritis$Improved=="Marked","A","B")
View(Arthritis)
It is giving only B in category field.. what is the problem?
Also , I dont find from where to post the query.. can you help me please?
 
Am I the first to post here? I have never learned any programming language so am hoping someone can answer this simple question.
For the below - what is the purpose of listing "x" in the middle line? I notice this happens in every instance of coding.

x=c(23L,41L,56L,1L,4.45)
x
class(x)

THANK YOU!
 
Hi Learners,

This thread is for you to discuss the queries and concepts related to Data Science with R only.

# Google Drive Link :
https://drive.google.com/drive/folders/1m2RkALawNvz2VXq_EbD6ozZQPsgNCSdQ?usp=sharing

Happy Learning !!

Regards,
Team Simplilearn
Am I the first to post here? I have never learned any programming language so am hoping someone can answer this simple question.
For the below - what is the purpose of listing "x" in the middle line? I notice this happens in every instance of coding.

x=c(23L,41L,56L,1L,4.45)
x
class(x)

THANK YOU!
 

Also a second question - can someone please explain the logic of the indentation of { } in coding?
I don't understand when to open { and when to close }

Example:
for (y in array)
{
if (y%%2!=0)
{
print (y)
}
}
 

Gaanashree S Patil_1

Administrator
Alumni
The recordings of your Live Virtual Class are available in the LMS in 24-48 hours post the session.


Please follow the below-mentioned steps for accessing the recordings:


1> Select the course in which the "Live classes " option is mentioned.

2> Select the "Live classes" option available on the extreme left-hand side.

3> Select the "Download recordings" blue hyperlink available under the registered batch.


NOTE: Please use a Windows PC or MAC to download and view the recording as the WebEx player is not compatible with other OS and devices.


To play the downloaded recording please find the below-mentioned links to install the latest NBR player.


https://simplilearnsolutions.webex.com/client/T33L/nbr2player.msi

If there is confusion still, kindly raise a ticket and the team will help you!
 

C R Anagha

New Member
Having a little trouble understanding the following piece of code.

temp <- c(22, 20, 24, 27, 29, 29, 29, 27, 25, 23)
temp[temp>25]
O/p : 27 29 29 29 27

This is my understanding :
1. The elements of temp have the indices 1, 2 , 3 and so on until 10.
2. Just temp>25 would give logical values ie, TRUE or FALSE depending on whether the condition is met.
3. How then can these logical values be specificied in the indexing (second line of code)? How is it giving all of those elements of temp that satisfy the condition?

It would really help if anybody can help me with the flow.
 
Also a second question - can someone please explain the logic of the indentation of { } in coding?
I don't understand when to open { and when to close }

Example:
for (y in array)
{
if (y%%2!=0)
{
print (y)
}
}

Typically you open brackets after any method, class, conditional statements and others, when there are tasks to do within the method, class or statement.

for instance you have your for(y in array) statement so you want {} underneath it to encapsulate the code to run for each y within the array....

then for your if(y %% 2 != 0) you'll need {} after to encapsulate the tasks to do when y goes into 2 with a remainder following the division.

It's best practice to use them and I typically indent anything within the {} for cleanliness so it'll look like.... this way it's readable for other coders as well. Think of them as the starting section and ending section for what is directly above them, be it a method or statement or whatever else.

for(y in array)
{
if(y %% 2 != 0)
{
print(y)​
}​
}
 
Last edited:
I have a question, my R Studio is importing my excel headers, that are dates within excel, as numbers for the Project 1 assignment... I'm not sure how to resolve this as some are dates within R and some are numbers so I can't really do step 2 for the Project as it is time related... in the attached image is the data table within R Studio showing that some headers are listed as dates and some are numbers. Any guidance is appreciated!

On another note, is there any practice tests before we take the test for the certificate?
 

Attachments

  • Screen Shot 2020-11-21 at 7.20.43 PM.png
    Screen Shot 2020-11-21 at 7.20.43 PM.png
    422 KB · Views: 4
Last edited:

ARJUN A_1

Member
Also a second question - can someone please explain the logic of the indentation of { } in coding?
I don't understand when to open { and when to close }

Example:
for (y in array)
{
if (y%%2!=0)
{
print (y)
}
}



Basically, Braces are used for functions, condition statements and loops. In your case for loop and if condition statement. The program is executed line by line. So, by providing braces, We tell the compiler/ interpreter that executes the program that whatever comes inside the braces is for function/condition/loop specified just before the brace opening.

In your example,

if (y%%2!=0)
{
print (y)
}

Tells the machine that execute print (y) statement only if reminder of 'y' not= 0.
similarly, for for loop, Each change in iteration of y is applicable only for the statements specified in the braces corresponding to for loop.

Eg; If array = [1,2,3,4,5,6] ,

In the 1st iteration of the for loop, y = 1, Will be applicable only inside,
for
{
.
.
Loop body
.
.
}

similarly for the next iterations where y will be = 2,3,4 till 6

=> Braces are used if a specific function, loop, condition contains more than 1 statement. But it is safe to use even if there is one statement as body of the function, loop, condition.
 
Hello!
1) I have been unable to install swirl package or any package into my library and run it. I tried following the steps Rahul has said in Class 2 but it's coming as failed. I am getting the following error:
Warning in install.packages :
'lib = "C:/Users/Anushree/Documents/R/win-library/4.0"' is not writable
Error in install.packages : unable to install packages

2) I am also unable to export my dataframe into a csv file. I am getting the following error:
Error in file(file, ifelse(append, "a", "w")) :
cannot open the connection
In addition: Warning message:
In file(file, ifelse(append, "a", "w")) :
cannot open file 'Batch June13/myFirstCSVFile.csv': No such file or directory
 
Last edited:
Hi everyone..
I am unable to get data of IRIS file..
When i View it, I can only see NULL data..
I was able to use it while working on live classes not now..
As shown in image below, It creates 2 files..upload_2020-11-25_12-25-59.png
upload_2020-11-25_12-25-59.png
 
Hi everyone..
I am unable to get data of IRIS file..
When i View it, I can only see NULL data..
I was able to use it while working on live classes not now..
As shown in image below, It creates 2 files..View attachment 12714
View attachment 12714

Hey Rishi,

you can actually add this dataset, along with a bunch of others through the datasets package:
install.packages("datasets")
library(datasets)
then View(Iris)

hope that helps! It comes with other data from the past as well such as stock market info and more just use ?datasets that should explain more

also when viewing you shouldn't use the "" as that is a string. so you are essentially saying view the "iris" string ;) should just be
View(iris)
 
Last edited:
Hey,

I'm wondering generally how long it takes for the reviewal of a submitted Project? Submitted mine yesterday morning and am anticipating the results :)

Thanks!
 

Nagma_1

Well-Known Member
Staff member
Simplilearn Support
Alumni
Hey,

I'm wondering generally how long it takes for the reviewal of a submitted Project? Submitted mine yesterday morning and am anticipating the results :)

Thanks!
Hi Kevin,

The evaluation team takes 5 days to evaluate the project, however, in the least cases, it might get extended to 7 days.
 
Screenshot (195).png

In the question Provide state wise status of complaints in a stacked bar chart. And then it is saying catagorized variable from Q3 this part i am unable to understand.

And except the code what should we give in the project?
 
View attachment 12836

In the question Provide state wise status of complaints in a stacked bar chart. And then it is saying catagorized variable from Q3 this part i am unable to understand.

And except the code what should we give in the project?
View attachment 12836

In the question Provide state wise status of complaints in a stacked bar chart. And then it is saying catagorized variable from Q3 this part i am unable to understand.

And except the code what should we give in the project?

Hi Shankha Roy. What I think is, you have to plot a bar chart with "x axis" as state and "Fill" with New categorized status (open & closed) from previous question" . Hope this helps. I did the same. Even though it looks messy :-D I do not know any other option.
 
Hi Shankha Roy. What I think is, you have to plot a bar chart with "x axis" as state and "Fill" with New categorized status (open & closed) from previous question" . Hope this helps. I did the same. Even though it looks messy :-D I do not know any other option.
Thanks for the help. I did the same too.
 
Has anyone successfully used the BoxCox command for normalizing data on the College Admission project? I can't seem to get it to work.
 

_90277

Member
I want to join current working directory and name of csv file and give it as argument to write csv function,
folliwing code not working, pls guide
write.csv(x=myFirstDF,file=(cat(getwd(),"\myCSVFile2.csv")),row.names=F)
 
Has anyone successfully used the BoxCox command for normalizing data on the College Admission project? I can't seem to get it to work.

Hey ! Even i was on the same batch... I've been working on comcast project... Any idea how to sort the complaint types in it ???
And do you know when is the last date to submit project ? And to attend simulation test?!
 
Hi Shankha Roy. What I think is, you have to plot a bar chart with "x axis" as state and "Fill" with New categorized status (open & closed) from previous question" . Hope this helps. I did the same. Even though it looks messy :-D I do not know any other option.


Hey how about the second question in that ??
Stating "which complaint types are maximum ?" I did not understand how to proceed with that....one... Any help ?!
 
hi rahul ji,can you share the link of google drive of yours previous batches ...for doing practicing the assignments , i had the link of batch nov 7 to dec 13 batch.
 
hi ,
anyone share the google drive link of previous batch of Data science with R which one shared by Rahul AAgarwal ji not the link of batch nov 7 to dec 13 2020 batch link
 

_90277

Member
Hi, trying to define data frame from vector, but column names comming wrong. in case of df1 get expected output, what is issue?
 

Attachments

  • Prob.png
    Prob.png
    154.8 KB · Views: 4
Top