Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Data Science
  3. Question
Data Science

How to overlay density plots in R?

Asked by Carl Paige Jun 7, 2021 844 views 1 answer
Share

About this question

I would like to overlay 2 density plots on the same device with R. How can I do that? I searched the web but I didn't find any obvious solution (I am rather new to R).

My idea would be to read data from a text file (columns) and then use

plot(density(MyData$Column1))
plot(density(MyData$Column2), add=T)

well, something in this spirit...

Thanks in advance

Your answer

1 Answer

More Data Science discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Data Science Blogs

Guides, tips and career advice on Data Science from JanBask experts.