Re: [R] How do I "teach" R that columns 1, 2, and 3 are the Year-Month-Day

2022-06-15 Thread Gregory Coats via R-help
I do not see any posting on this topic from Jeff Newmiller. I seek a way to “teach” R that "2021-07-25” represents a Year, Month, and Day. Greg Coats > Fuel <- c(50.45, 61.48, 59.07, 55.40, 30.63, 41.35, 32.81, 49.86, 62.99, > 89.37) > plot (Fuel) > Dates <- c("2021-07-25", "2021-08-27", "2021-09

[R] How do I "teach" R that columns 1, 2, and 3 are the Year-Month-Day

2022-06-14 Thread Gregory Coats via R-help
# Column 1 is the Year # Column 2 is the Month # Column 3 is the Day # Column 4 is the Fuel Fuel <- c(50.45, 61.48, 59.07, 55.40, 30.63, 41.35, 32.81, 49.86, 62.99, 89.37) plot (Fuel) 2021 7 25 50.45 2021 8 27 61.48 2021 9 26 59.07 2021 11 4 55.40 2021 11 22 30.63 2021 11 26

Re: [R] library(hms)

2021-03-17 Thread Gregory Coats via R-help
, 2021, at 1:07 PM, Gregory Coats via R-help > wrote: > > On my MacBook, I do not have, and do not know how to install, library(hms). > Greg Coats > >> library(hms) > Error in library(hms) : there is no package called ‘hms’ >> Install.libraries(“hms”) > Error: u

[R] library(hms)

2021-03-17 Thread Gregory Coats via R-help
On my MacBook, I do not have, and do not know how to install, library(hms). Greg Coats > library(hms) Error in library(hms) : there is no package called ‘hms’ > Install.libraries(“hms”) Error: unexpected input in "Install.libraries(“" > [[alternative HTML version deleted]] __

Re: [R] How to plot dates

2021-03-16 Thread Gregory Coats via R-help
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

Re: [R] How to plot dates

2021-03-16 Thread Gregory Coats via R-help
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

Re: [R] How to plot dates

2021-03-16 Thread Gregory Coats via R-help
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

Re: [R] How to plot dates

2021-03-16 Thread Gregory Coats via R-help
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]], ...)

Re: [R] How to plot dates

2021-03-16 Thread Gregory Coats via R-help
cification, the as.POSIXct function works as expected >> on Mac: >>> >>> 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-12 09:17:02 >>> 2021-

Re: [R] How to plot dates

2021-03-16 Thread Gregory Coats via R-help
time > 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 = ",", header = TRUE) > > myDat$datetime <- as.POSIXct(myDat$datetime, tz = &quo

Re: [R] How to plot dates

2021-03-16 Thread Gregory Coats via R-help
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

[R] How to plot dates

2021-03-15 Thread Gregory Coats via R-help
I store in a text file the dates and times that an event occurred. How do I direct R to import these text characters, and store the year, month, day, hour, minute, and second as a date? How do I then plot this series of dates? 2021-03-11 10:00:00 2021-03-11 14:17:00 2021-03-12 05:16:46 2021-03-12

Re: [R] A question regarding 749 R[21525:2855847] Warning

2021-01-15 Thread Gregory Coats via R-help
I reported this behavior on Thu Jan 7, 2021. You did nothing wrong. No fix has been issued. This evening, I upgraded from R 4.0.2 to the Duke University R 4.0.3 for Apple Mac. Now all I can get from R 4.0.3 is this red error message (that means nothing to me). Is there an easy fix? Greg 2021-01

[R] Expected min height of view

2021-01-07 Thread Gregory Coats via R-help
I upgraded from R 4.0.2 to R 4.0.3 for Apple Mac at Duke University. Now, the only output I get from R 4.0.3 is an error message. Greg Coats 2021-01-07 22:58:42.997 R[8311:37566] Warning: Expected min height of view: () to be less than or equal to 30 but got a height of 32.00. This error wil

[R] A Labeling the median

2020-12-29 Thread Gregory Coats via R-help
After calling plot, I draw a horizontal line representing the median with aline. abline (h=median(walk_seconds), lty=1, lwd=2.0, col="firebrick4") Then, I want to label that line as the median and do so by calling mtext. mtext (side=4, "median", col="firebrick4", adj=“0.50”) The dilemma is I do no

Re: [R] How to specify year-month-day for a plot

2020-12-18 Thread Gregory Coats via R-help
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-

Re: [R] How to specify year-month-day for a plot

2020-12-16 Thread Gregory Coats via R-help
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

Re: [R] How to specify year-month-day for a plot

2020-12-16 Thread Gregory Coats via R-help
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 be

Re: [R] How to specify year-month-day for a plot

2020-12-16 Thread Gregory Coats via R-help
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

Re: [R] How to specify year-month-day for a plot

2020-12-13 Thread Gregory Coats via R-help
.652", > header=TRUE,stringsAsFactors=FALSE, > col.names=c("date","gallons")) > gcdf$date<-as.Date(gcdf$date,"%Y-%m-%d") > plot(gcdf$date,gcdf$gallons,main="Gallons by date", > xlab="Date",ylab="Gallons") > > J

[R] How to specify year-month-day for a plot

2020-12-13 Thread Gregory Coats via R-help
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

[R] R Compied for Mac OS X

2020-06-25 Thread Gregory Coats via R-help
Today, I downloaded, and installed the June 6, 2020 version of R, from the CRAN official site at Carnegie Mellon University. Unfortunately, while the CMU compiled Mac OS X R application provides access to base R stat functions, like mean, it does not provide me with access to any of R’s more adv