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, 2022 in Data Science by Avinash
• 1,260 points
1,019 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.

Discover the world of data with our Data Science Course and embark on a transformative journey towards analytical excellence.

answered Jun 24, 2022 by Sohail
• 3,040 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, 2022 in Data Science by Avinash
• 1,260 points
312 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, 2022 in Data Science by Sohail
• 3,040 points
466 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, 2022 in Data Science by avinash
• 1,840 points
302 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, 2022 in Data Science by avinash
• 1,840 points
445 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,370 points
2,152 views
0 votes
1 answer

Plot logistic regression curve in R

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

answered Apr 4, 2022 in Machine Learning by Nandini
• 5,480 points
2,405 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, 2022 in Others by Kichu
• 19,040 points
590 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, 2022 in Data Analytics by Avinash
• 1,260 points
332 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, 2022 in Data Science by Sohail
• 3,040 points
1,048 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, 2022 in Data Science by Sohail
• 3,040 points
485 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP