If I have data like this
DF <- data.frame(
date = seq(Sys.Date()-1000, len=1000, by="1 day")[sample(1000, 500)],
price = runif(500)
)
How do I plot e.g. mean of price in the function of time, e.g. in months, using ggplot2?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to convert your dates into months using
cut(,"months"), then applymeanto each month using ggplotstat_summary. Here’s how to do it inqplot, which is a compact convenience wrapper toggplot.alt text http://www.imagechicken.com/uploads/1264786975079660800.png
Base plot can also do it:
alt text http://www.imagechicken.com/uploads/1264786673030283100.png