Re: [R] Converting time format

2022-09-19 Thread Parkhurst, David
Thank you. From: Rui Barradas Date: Monday, September 19, 2022 at 1:28 PM To: Parkhurst, David , R-help@r-project.org Subject: Re: [R] Converting time format Hello, I will run the examples below with the following data: x <- c("12:00", "12:15", "12:30",

Re: [R] Converting time format

2022-09-19 Thread Parkhurst, David
Thank you. I�ll see what I can do with that. From: Rui Barradas Date: Monday, September 19, 2022 at 1:28 PM To: Parkhurst, David , r-help@r-project.org Subject: Re: [R] Converting time format Hello, I will run the examples below with the following data: x <- c("12:00", &q

Re: [R] Converting time format

2022-09-19 Thread Rui Barradas
Hello, I will run the examples below with the following data: x <- c("12:00", "12:15", "12:30", "12:45", "13:00", "13:15", "13:30", "13:45", "14:00", "14:15", "14:30", "14:45", "15:00", "15:15", "15:30", "15:45", "16:00", "16:15", "16:30", "16:45", "17:00", "17:15", "17:30"

Re: [R] Converting time format

2022-09-19 Thread Eric Berger
What is the output of > class(b$time) ? Also, start sending your emails in plaint text format, if possible. On Mon, Sep 19, 2022 at 2:12 PM Parkhurst, David wrote: > > I have a dataframe obtained using read.csv from an excel file. Its first > column is times, running from 18:00 to 19:30. If

[R] Converting time format

2022-09-19 Thread Parkhurst, David
I have a dataframe obtained using read.csv from an excel file. Its first column is times, running from 18:00 to 19:30. If I want to plot other columns against time, do I need to convert those somehow, and how would I do that? If I run plot(b$time,b$myvar) I get a decent plot, but a friend sugg

Re: [R] converting time format

2017-02-22 Thread Jim Lemon
Sure: df.count.mon$time<-format(as.Date(paste(df.count.mon$year, df.count.mon$mon,1), '%Y %m %d'),"%Y %m") > df.count.mon count year montime 1 22 2014 1 2014 01 2 12 2014 2 2014 02 ... Jim On Thu, Feb 23, 2017 at 8:18 AM, lily li wrote: > Yes, it is a little different. Is t

Re: [R] converting time format

2017-02-22 Thread lily li
Yes, it is a little different. Is there a way to get '-mm' format? Thanks. On Wed, Feb 22, 2017 at 2:10 PM, Jim Lemon wrote: > Hi Lily. > Two problems. You have named the month field "mon" and then refer to > it as "month". Second, as the resolution of as.Date is days, it can't > produce a v

Re: [R] converting time format

2017-02-22 Thread Jim Lemon
Hi Lily. Two problems. You have named the month field "mon" and then refer to it as "month". Second, as the resolution of as.Date is days, it can't produce a valid date without specifying the day. Thus: df.count.mon<-data.frame(count=sample(1:24,24), year=rep(2014:2015,each=2),mon=rep(1:12,2)) #

[R] converting time format

2017-02-22 Thread lily li
Hi R users, I have a dataframe, with year, month, day, and other variables. I wanted to calculated monthly values of the variables. For example, there is one variable called 'count'. I use the code below to convert daily data to monthly data. df.count.mon = aggregate(count ~ year+month, data= df,