How to overlay density plots in R

0 votes
I'd like to use R to overlay two density graphs on the same device. I'm not sure how I'm going to accomplish it. I looked on the internet for a solution but couldn't locate one.

My plan is to read data from a text file (columns) and then use it in a programme.

plot(density(MyData$Column1))
plot(density(MyData$Column2), add=T), plot(density(MyData$Column2), plot(density(MyData$Colum
Or something along those lines.
Jun 14 in Data Science by Avinash
• 1,260 points
31 views

1 answer to this question.

0 votes
The second one has 104 usage lines:

plot(density(MyData$Column1)) \slines(density(MyData$Column2))
but make sure the first plot's boundaries are appropriate.
answered Jun 24 by Sohail
• 2,960 points

Related Questions In Data Science

0 votes
0 answers

how to make 2 separate substrings from strsplit in R

When it comes to accessing the elements ...READ MORE

Jun 13 in Data Science by Avinash
• 1,260 points
14 views
0 votes
1 answer

How to implement Knn-algorithm without using k-nn function in r?

I created an example that demonstrates the ...READ MORE

answered Jun 24 in Data Science by Sohail
• 2,960 points
14 views
0 votes
0 answers

In R, how to get an object's name after it is sent to a function?

I'm trying to find the opposite of ...READ MORE

Jul 5 in Data Science by avinash
• 1,840 points
8 views
0 votes
0 answers

How to manually find the minors of a matrix in R programming?

I have to write a function that ...READ MORE

Jul 5 in Data Science by avinash
• 1,840 points
8 views
0 votes
1 answer

Save a plot as image on the disk using R

Consider for both the situations: 1. Image will ...READ MORE

answered Apr 14, 2018 in Data Analytics by Sahiti
• 6,380 points
1,224 views
0 votes
1 answer

Plot logistic regression curve in R

The Code looks something like this: fit = ...READ MORE

answered Apr 4 in Machine Learning by Nandini
• 5,480 points
497 views
0 votes
0 answers

Error in plot.new() : figure margins too large, Scatter plot

My code: par(mfcol=c(5,3)) hist(RtBio, main="Histograma de Bio Pappel") boxplot(RtBio, main="Diagrama ...READ MORE

May 17 in Others by Kichu
• 19,040 points
25 views
0 votes
0 answers

How to generate correlation plot of my data.frame in R?

I have a df and I want ...READ MORE

Jun 9 in Data Analytics by Avinash
• 1,260 points
20 views
0 votes
1 answer

How to make loop for one-at-a time logistic regression in R?

You're probably looking for something similar to ...READ MORE

answered Jun 20 in Data Science by Sohail
• 2,960 points
62 views
0 votes
1 answer

How To Create Vector of Vector In R

Create a list: List() on x returns x[[1]] ...READ MORE

answered Jun 24 in Data Science by Sohail
• 2,960 points
23 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP