Hi ektaraK, Here is a step by step way to create an example and get your plot:
# make up a lot of dates dates<-as.Date("2021-1-1")+sample(0:364,100) # make up the temperatures temps<-runif(100,0,40) # create a data frame mydf<-data.frame(date=dates,temp=temps) # create a month variable mydf$month<-factor(format(mydf$date,"%b"),levels=month.abb) # calculate mean temperature for months temp_x_month<-by(mydf$temp,mydf$month,mean) # create a factor of the months of the year for plotting months<-factor(month.abb,levels=month.abb) # plot mean temperature by month plot(months,temp_x_month,main="Mean temperature by month") You may only need to apply the last three steps to your data. Jim On Sun, Feb 27, 2022 at 1:07 AM Ebert,Timothy Aaron <teb...@ufl.edu> wrote: > > I did not get the data .... but I was wondering what you have already tried. > Try group_by() function > Try fill= or color= in the aes() statement in ggplot. > > What is the goal? > Do you want lines, bars, or dots? > > Is this a class? > > Tim > > -----Original Message----- > From: R-help <r-help-boun...@r-project.org> On Behalf Of ektaraful > Sent: Saturday, February 26, 2022 2:00 AM > To: r-help@r-project.org > Subject: [R] Plot by month > > [External Email] > > Hi, > > I want to plot temp data from a csv file by month. Can you help me how I can > do it in R? > > A sample csv file is attached herewith. Please use left hand data. > > Thanks. > ektaraK > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dhelp&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=JeHylIm3ibHTYNZ-mLAAkF4JTrj_xyBnd0IQBZDJvV6HeovFeOLa5GwBe0LLBOwN&s=WJLtDEQ05d0kvlWFlrGCadjyBvwqCm_j37wsJ-CObyA&e= > PLEASE do read the posting guide > https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_posting-2Dguide.html&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=JeHylIm3ibHTYNZ-mLAAkF4JTrj_xyBnd0IQBZDJvV6HeovFeOLa5GwBe0LLBOwN&s=QyEPln_51yStVY2Ec1hcAqygLeEh1CNf5JJT_vv1dto&e= > and provide commented, minimal, self-contained, reproducible code. > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.