Hi
install.packages("lubridate") does not work on Mac?
Cheers
Petr
> -Original Message-
> From: R-help On Behalf Of Gregory Coats
> via R-help
> Sent: Wednesday, March 17, 2021 1:11 AM
> To: Daniel Nordlund
> Cc: r-help mailing list
> Subject: Re:
Gross <mailto:avigr...@verizon.net>
Cc: mailto:r-help@r-project.org
Subject: Re: [R] How to plot dates
Thank you very much.
In addition to what your did, for event 1, I would like to draw a horizontal
line connecting from day 1 to day 2 to day 3 to day 4.
Then, for event 2, I would like to draw
Thank you very much.
In addition to what your did, for event 1, I would like to draw a horizontal
line connecting from day 1 to day 2 to day 3 to day 4.
Then, for event 2, I would like to draw a horizontal line connecting from day 1
to day 2 to day 3 to day 4.
Similarly for events 3, and 4. Is th
Dan, Thank you for this guidance.
Unfortunately, I do not have the library lubridate, and I do not at this moment
know where to go to get this library for an Apple MacBook.
> library(lubridate)
Error in library(lubridate) : there is no package called ‘lubridate’
Greg Coats
Reston, Virginia USA
geom_text(aes(color=seq))
-Original Message-
From: R-help On Behalf Of Gregory Coats via
R-help
Sent: Tuesday, March 16, 2021 6:32 PM
To: John Fox
Cc: r-help mailing list
Subject: Re: [R] How to plot dates
Thank you. Let me redefine the situation.
Each time an event starts, I
On 3/16/2021 3:32 PM, Gregory Coats via R-help wrote:
Thank you. Let me redefine the situation.
Each time an event starts, I record the date and time.
Each day there are 4 new events. Time is the only variable.
I would like to graphically show how the time for events 1, 2, 3, and 4 for the
curre
Thank you. Let me redefine the situation.
Each time an event starts, I record the date and time.
Each day there are 4 new events. Time is the only variable.
I would like to graphically show how the time for events 1, 2, 3, and 4 for the
current day compare to the times for events 1, 2, 3, and 4 fo
Hi Greg,
This example may give you a start:
myDat<-read.table(text=
"2021-03-11 10:00:00
2021-03-11 14:17:00
2021-03-12 05:16:46
2021-03-12 09:17:02
2021-03-12 13:31:43
2021-03-12 22:00:32
2021-03-13 09:21:43",
sep=",",
stringsAsFactors=FALSE)
myDat$datetime<-strptime(myDat$X,for
Hello,
I don't really understand what is to be plotted, just the time of the
event? But what event?
Anyway, with the data read with Sarah's code, maybe
library(ggplot2)
ggplot(myDat, aes(x = datetime, y = 1)) +
geom_linerange(aes(ymin = 0, ymax = 1), linetype = "dotted") +
geom_point()
Dear Greg,
Coordinate plots typically have a horizontal (x) and vertical (y) axis.
The command
ggplot(myDat, aes(x=datetime, y = datetime)) + geom_point()
works, but I doubt that it produces what you want.
You have only one variable in your data set -- datetime -- so it's not
obviou
I need a plot that shows the date and time that each event started.
This ggplot command was publicly given to me via this R Help Mailing LIst.
But the result of issuing the ggplot command is an Error in FUN message.
ggplot(myDat, aes(x=datetime, y = Y_Var)) + geom_point()
Error in FUN(X[[i]], ...)
So what do you want quantity on the y-axis to be?
On March 16, 2021 11:45:32 AM PDT, Gregory Coats wrote:
>I want to plot the date and time of the event, as reflected in data.
>2021-03-11 10:00:00
>Greg Coats
>
>> On Mar 16, 2021, at 2:23 PM, Jeff Newmiller
> wrote:
>>
>> You don't seem to have
I want to plot the date and time of the event, as reflected in data.
2021-03-11 10:00:00
Greg Coats
> On Mar 16, 2021, at 2:23 PM, Jeff Newmiller wrote:
>
> You don't seem to have a Y_Var in your data. What is it that you want to plot?
>
> On March 16, 2021 9:21:05 AM PDT, Gregory Coats via R-h
You don't seem to have a Y_Var in your data. What is it that you want to plot?
On March 16, 2021 9:21:05 AM PDT, Gregory Coats via R-help
wrote:
>Sarah, Thank you. Yes, now as.POSIXct works.
>But the ggplot command I was told to use yields an Error message, and
>there is no output plot.
>Please
Dear Greg,
There is no variable named Y_Var in your data set. I suspect that it's
intended to be a generic specification in the recipe you were apparently
given. In fact, there appears to be only one variable in myDat and
that's datetime. What is it that you're trying to do?
A more general c
Sarah, Thank you. Yes, now as.POSIXct works.
But the ggplot command I was told to use yields an Error message, and there is
no output plot.
Please help me. Greg
> library(ggplot2)
> myDat <- read.table(text =
+ "datetime
+ 2021-03-11 10:00:00
+ 2021-03-11 14:17:00
+ 2021-03-12 05:16:46
+ 2021-03-1
Hi,
It doesn't have anything to do with having a Mac - you have POSIX.
It's because something is wrong with your data import. Looking at the
head() output you provided, it looks like your data file does NOT have
a header, because there's no datetime column, and the column name is
actually X2021.0
My computer is an Apple MacBook. I do not have POSIX.
The command
myDat$datetime <- as.POSIXct(myDat$datetime, tz = "", format = "%Y-%M-%d
%H:%M:%OS")
yields the error
Error in `$<-.data.frame`(`*tmp*`, datetime, value = numeric(0)) :
replacement has 0 rows, data has 13
Please advise, How to p
Hi Greg,
As the POSIX conversion part is already answered, I'll add:
as.Date("16/03/2021",format="%d/%m/%Y")
converts to Date object and
axis.Date()
will display dates on the date axis in base graphics.
Jim
On Tue, 16 Mar 2021, 08:33 Gregory Coats via R-help I store in a text file the dates
Gregory
myDat <- data.frame(datetime = c("2021-03-11 10:00:00","2021-03-11
14:17:00","2021-03-12 05:16:46","2021-03-12 09:17:02",
"2021-03-12 13:31:43","2021-03-12 22:00:32","2021-03-13
09:21:43","2021-03-13 13:51:12",
"2021-03-13 18:03:13","2021-03-13 22:20:28","2021-03-14
0
20 matches
Mail list logo