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
It appears that install.libraries(“hms”) is unsuccessful, but that install.packages(“hms”) is successful. install.packages("lubridate") downloaded 1.5 MB install.packages("hms") downloaded 95 KB install.packages("data.table") downloaded 2.2 MB Greg > On Mar 17

[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
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,

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
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(v=grid_dates,lty=4) >

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

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

[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

Re: [R] Adding Year-Month-Day to X axis

2018-05-08 Thread Gregory Coats
I do not see any difference between the x versus y plot drawn in blue, and the y only plot drawn in red. Is the correct? Greg y_duration <- c (301.59050, 387.35700, 365.64366, 317.26150, 321.71883, 342.44950, 318.95350, 322.33233, 330.60333, 428.99516, 297.82066, 258.23166, 282.01816, 280.0

Re: [R] Adding Year-Month-Day to X axis

2018-05-08 Thread Gregory Coats
Since the horizontal axis side=1 is year-month-day, how do I issue an abline command to draw dashed vertical lines, as a background grid, within the graph’s border? Similar to the abline command I call below, in blue, for dashed horizontal lines, as a background grid. Greg y_duration <- c (301.

Re: [R] Adding Year-Month-Day to X axis

2018-05-06 Thread Gregory Coats
Thanks. Regarding axis(1,at=x_mmdd,labels=format(x_mmdd,"%Y-%m-%d")) How do I get the text for -MM-DD to be drawn vertically, instead of horizontally? Greg > On May 6, 2018, at 11:54 PM, Jim Lemon wrote: > > axis(1,at=x_mmdd,labels=format(x_mmdd,"%Y-%m-%d")) [[al

Re: [R] Adding Year-Month-Day to X axis

2018-05-06 Thread Gregory Coats
Jim, Thank you very much! How do I use the axis command for side=1 to label the x horizontal axis, in the format="%Y-%m-%d” style? Greg y_duration <- c (301.59050, 387.35700, 365.64366, 317.26150, 321.71883, 342.44950, 318.95350, 322.33233, 330.60333, 428.99516, 297.82066, 258.23166)

Re: [R] Adding Year-Month-Day to X axis

2018-05-05 Thread Gregory Coats
Jim, Thanks for responding! I am using the official R 3.5.0 for Mac OS X. This apparently does not include library (plotrix) library(plotrix) Error in library(plotrix) : there is no package called ‘plotrix’ Greg > On May 5, 2018, at 6:50 PM, Jim Lemon wrote: > > Hi Greg, > What you are getting

Re: [R] Adding Year-Month-Day to X axis

2018-05-05 Thread Gregory Coats
Jim, That you very much! How do I instruct staxlab to label once every n days, rather than labeling every day? Greg > On May 5, 2018, at 6:50 PM, Jim Lemon wrote: > > staxlab(1,at=x_mmdd,labels=format(x_mmdd,"%Y-%m-%d")) [[alternative HTML version deleted]] __

[R] Adding Year-Month-Day to X axis

2018-05-05 Thread Gregory Coats
I am using R 3.5.0 for Mac OS X. Issuing these two commands yields the expected plot. y_duration <- c (301.59050, 387.35700, 365.64366, 317.26150, 321.71883, 342.44950, 318.95350, 322.33233, 330.60333, 428.99516, 297.82066) plot (y_duration, type="l”) Adding Year-Month-Day values for th

[R] How to direct R to read commands from a text file

2015-10-30 Thread Gregory Coats
All of the R commands that I want to issue are in a text file that concludes with the R command quit (save = “yes”), and is called R_commands.txt. I can start R, and then manually issue source (“R_commands.txt”). But I would prefer to issue, from the bash command line, a one line command, direct