Have you tried
abline(v=as.Date("2019-04-06"), col="red")
-Bill
On Fri, Dec 18, 2020 at 9:29 AM Gregory Coats wrote:
> I need to be able to draw and label a vertical line, representing the date
> of some arbitrary event. The date of the first entry is 2013-11-29. How
> would I draw, and labe
I need to be able to draw and label a vertical line, representing the date of
some arbitrary event. The date of the first entry is 2013-11-29. How would I
draw, and label a red vertical line at 2019-04-06? Greg
gcdf<-read.table(text="2013-11-29 19.175
2014-01-20 10.072
2014-02-12 10.241
2014-03-
Don't set the header argument to TRUE if your data does not have a header?
On December 16, 2020 11:09:18 AM PST, Gregory Coats via R-help
wrote:
>I would like to be able to draw and label a vertical line, representing
>the date of some arbitrary event. The date of the first non-zero entry
>is 20
I would like to be able to draw and label a vertical line, representing the
date of some arbitrary event. The date of the first non-zero entry is
2013-11-29. How would I draw and label a red vertical line at 2019-04-06? Greg
gcdf<-read.table(text="2013-11-29 00.000
2013-12-29 19.175
2014-01-20 1
You didn't show the entire call to read.table. If it included the argument
header=TRUE then it would make the first entry in each column the name of
the column. Use header=FALSE (or omit the header argument) if you don't
want the first entry to be considered the column name.
-Bill
On Wed, Dec 1
I added a zero initial entry to the data set. Greg
gcdf<-read.table(text="2013-11-29 00.000
2013-12-29 19.175
2014-01-20 10.072
2014-02-12 10.241
2014-03-02 05.916
> On Dec 16, 2020, at 12:32 PM, Gregory Coats via R-help
> wrote:
>
> Jim, Thank you!
> The data set begins
> gcdf<-read.table(text
Jim, Thank you!
The data set begins
gcdf<-read.table(text="2013-12-29 19.175
2014-01-20 10.072
2014-02-12 10.241
I note that data begins in 2013. But the plot command does not show this first
entry in 2013, and instead shows the second data pair as the first data pair.
As a consequence, plot does
Hi Greg,
I think this does what you want:
gcdf$date<-as.Date(gcdf$date,"%Y-%m-%d")
grid_dates<-as.Date(paste(2014:2020,1,1,sep="-"),"%Y-%m-%d")
plot(gcdf$date, gcdf$gallons, main="2014 Toyota 4Runner", xlab="Date",
ylab="Gallons",type="l",col="blue",yaxt="n")
abline(h=seq(4,20,by=2),lty=4)
abline
Bill pointed out some errors in your code but you keep making the claim that
-MM-DD is not recognized and I just want to make it completely clear that
that is the default format for dates in R as it is an ISO standard. So focus on
other issues until you get it working... this format is defin
Hi Gregory,
On Mon, Dec 14, 2020 at 12:34 PM Gregory Coats wrote:
>...
> Is there a convenient way to tell R to interpret “2020-12-13” as a date?
>
Notice the as.Date command in the code I sent to you. this converts a
string to a date with a resolution of one day. If you want a higher
time resolu
You left out some calls to c(). Note that
(2,3,5)
is not valid syntax for making a vector of numbers; use
c(2,3,5)
You also left out a comma and gave different lengths for day and value.
You also left out plus signs between the various components of your ggplot
expression.
Try
data <- data
Hi Jim,
Thank you VERY much!
In what I tried, my values for the vertical Y were automatically understood by
R.
But it appears that the string -mm-dd was NOT recognized by R as a date for
the X axis, and gave a red error message.
My values for Year-Month-Day were NOT understood by R.
Is there
By converting the character date data into a time-like type... e.g. ?as.Date
and plotting y-vs-x.
On December 12, 2020 11:18:46 AM PST, Gregory Coats via R-help
wrote:
>Starting with year-month-day, for the variable gallons, I can easily
>plot the variable gallons, while disregarding the date.
Hi Gregory,
Here's a start:
gcdf<-read.table(text="2020-01-05 15.973
2020-02-15 18.832
2020-03-10 17.392
2020-05-04 14.774
2020-06-21 19.248
2020-08-01 14.913
2020-08-27 15.226
2020-09-28 14.338
2020-11-09 18.777
2020-12-11 19.652",
header=TRUE,stringsAsFactors=FALSE,
col.names=c("date","gallons")
Starting with year-month-day, for the variable gallons, I can easily plot the
variable gallons, while disregarding the date.
gallons <- c (15.973, 18.832, 17.392, 14.774, 19.248, 14.913, 15.226, 14.338,
18.777, 19.652)
plot (gallons, type="l", xlab="X label", ylab="Y label", col="blue”)
How do
15 matches
Mail list logo