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
15 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 6 days ago 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
3 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 6 days ago in Data Science by Sohail
• 2,960 points
8 views
0 votes
0 answers

Introduction to Statistical Learning with Applications in R Figure Codes

I recently bought the following book: An Introduction ...READ MORE

Jun 1 in Data Science by avinash
• 860 points
20 views
0 votes
1 answer

Why is it not advisable to use attach() in R, and what should I use instead?

There is one more option that applies ...READ MORE

answered 6 days ago in Data Science by Sohail
• 2,960 points
7 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,163 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
304 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
12 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
7 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
19 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 6 days ago in Data Science by Sohail
• 2,960 points
11 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