[R] Need help plotting

Ebert,Timothy Aaron tebert @end|ng |rom u||@edu
Mon Sep 19 20:11:22 CEST 2022


David,
   Do these work for you? (I am resending this so others can see. The original only went to you.)

library(lubridate)
a<-c(4, 5, 6)
b<-c("18:00", "18:01", "18:02")
c<-as.data.frame(cbind(a,b))
c$d<-hm(c$b)
c$d$minute[2]

I could do it manually like this (where FrHour is fractional hour)
a<-c(4, 5, 6)
b<-c("18:00", "18:09", "18:42")
c<-as.data.frame(cbind(a,b))
c$d<-hm(c$b)
c$d$minute[2]
c$Hour=as.numeric(substr(c$b,1,2))
c$Second=as.numeric(substr(c$b,4,5))
c$FrHour <- c$Hour + c$Second/60

As I was writing Rui posted another option with code for graphing.

Tim

-----Original Message-----
From: R-help <r-help-bounces using r-project.org> On Behalf Of Parkhurst, David
Sent: Sunday, September 18, 2022 4:27 PM
To: r-help using 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]]



More information about the R-help mailing list