My version of this email has a bunch of ? that I do not know how to interpret. Emails to this group need to be in plain text. HTML content is deleted or converted and impossible or at least difficult to interpret. Do not share confidential data. Please change some numbers or variable names and share that. If this helps: 1) Make sure your time variable is a datetime object. 2) At least in ggplot it should now behave as expected. ggplot(df, aes(y=NO2, x=datetime)) + geom_point() That will be a start as a scatterplot, but the graph can be customized or changed if scatterplot was not desired. Tim -----Original Message----- From: R-help <r-help-bounces at r-project.org> On Behalf Of Parkhurst, David Sent: Sunday, September 18, 2022 4:27 PM To: r-help at r-project.org Subject: [R] Need help plotting [External Email] I?ve been retired since ?06 and have forgotten most of R. Now I have a use for it, with some data from Bloomington?s Environmental Commission. I have a dataframe (obtained from read.csv) that contains numerous columns, including time (in Excel?s 18:00 format), and DNO2, and MNO2 from two air quality instruments. I?d like a plot of both the NO2 measurements against time. I be happy to use either ordinary R plots or ggplot2 ones, if that would be a better way. I?d much appreciate help. [[alternative HTML version deleted]]
Thank you. DFP (iPad)> On Sep 19, 2022, at 8:15 AM, Ebert,Timothy Aaron <tebert at ufl.edu> wrote: > > ?My version of this email has a bunch of ? that I do not know how to interpret. Emails to this group need to be in plain text. HTML content is deleted or converted and impossible or at least difficult to interpret. > > Do not share confidential data. Please change some numbers or variable names and share that. > If this helps: > 1) Make sure your time variable is a datetime object. > 2) At least in ggplot it should now behave as expected. > ggplot(df, aes(y=NO2, x=datetime)) + geom_point() > > That will be a start as a scatterplot, but the graph can be customized or changed if scatterplot was not desired. > > Tim > > -----Original Message----- > From: R-help <r-help-bounces at r-project.org> On Behalf Of Parkhurst, David > Sent: Sunday, September 18, 2022 4:27 PM > To: r-help at r-project.org > Subject: [R] Need help plotting > > [External Email] > > I?ve been retired since ?06 and have forgotten most of R. Now I have a use for it, with some data from Bloomington?s Environmental Commission. > > I have a dataframe (obtained from read.csv) that contains numerous columns, including time (in Excel?s 18:00 format), and DNO2, and MNO2 from two air quality instruments. > > I?d like a plot of both the NO2 measurements against time. I be happy to use either ordinary R plots or ggplot2 ones, if that would be a better way. I?d much appreciate help. > > [[alternative HTML version deleted]] >
See ?date-time and/or ?strptime for how to convert what I presume is character data in your datetime column to a POSIXct object. (you may first need to convert from a factor to character with as.character() ). Then follow Tim's prescription for ggplot or see ?axis.Date (especially the examples) for how to do it with base R plots. Cheers, Bert On Mon, Sep 19, 2022 at 5:15 AM Ebert,Timothy Aaron <tebert at ufl.edu> wrote:> My version of this email has a bunch of ? that I do not know how to > interpret. Emails to this group need to be in plain text. HTML content is > deleted or converted and impossible or at least difficult to interpret. > > Do not share confidential data. Please change some numbers or variable > names and share that. > If this helps: > 1) Make sure your time variable is a datetime object. > 2) At least in ggplot it should now behave as expected. > ggplot(df, aes(y=NO2, x=datetime)) + geom_point() > > That will be a start as a scatterplot, but the graph can be customized or > changed if scatterplot was not desired. > > Tim > > -----Original Message----- > From: R-help <r-help-bounces at r-project.org> On Behalf Of Parkhurst, David > Sent: Sunday, September 18, 2022 4:27 PM > To: r-help at r-project.org > Subject: [R] Need help plotting > > [External Email] > > I?ve been retired since ?06 and have forgotten most of R. Now I have a > use for it, with some data from Bloomington?s Environmental Commission. > > I have a dataframe (obtained from read.csv) that contains numerous > columns, including time (in Excel?s 18:00 format), and DNO2, and MNO2 from > two air quality instruments. > > I?d like a plot of both the NO2 measurements against time. I be happy to > use either ordinary R plots or ggplot2 ones, if that would be a better > way. I?d much appreciate help. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. >[[alternative HTML version deleted]]