Re: [R] Date Time in R

2016-07-26 Thread Shivi Bhatia
>> >>>>> > So this looks correct so far. >>>>> > >>>>> > >>>>> > >>>>> > # convert strings (or factors) to a date object >>>>> > >>>>> > a1$date <- as.Date(a1$date, “%m-%d-%y”) >

Re: [R] Date Time in R

2016-07-26 Thread William Dunlap via R-help
) >>>> > >>>> > >>>> > >>>> > # Note the date object is now displayed in the format %Y-%m-%d by >>>> default >>>> > >>>> > # so no need for the mdy() or ymd() function >>>> > >>

Re: [R] Date Time in R

2016-07-26 Thread Shivi Bhatia
; # so no need for the mdy() or ymd() function >>> > >>> > >>> > >>> > # extract the weekdays as number >>> > >>> > weekdays <- wday(a1$date) >>> > >>> > >>> > >>> > #

Re: [R] Date Time in R

2016-07-26 Thread Shivi Bhatia
y(a1$date) >> > >> > >> > >> > # note can’t have spaces in variable names >> > >> > week_names <- wday(a1$date, label=TRUE) >> > >> > >> > >> > >> > >> > *From:* Shivi Bhatia [mail

Re: [R] Date Time in R

2016-07-26 Thread William Dunlap via R-help
gt; # note can’t have spaces in variable names > > > > week_names <- wday(a1$date, label=TRUE) > > > > > > > > > > > > *From:* Shivi Bhatia [mailto:shivipm...@gmail.com] > > *Sent:* July 26, 2016 12:16 PM > > *To:* Tom Wright <

Re: [R] Date Time in R

2016-07-26 Thread Shivi Bhatia
bel=TRUE) > > > > > > *From:* Shivi Bhatia [mailto:shivipm...@gmail.com] > *Sent:* July 26, 2016 12:16 PM > *To:* Tom Wright <t...@maladmin.com> > *Cc:* David L Carlson <dcarl...@tamu.edu>; r-help <r-help@r-project.org> > > *Subject:* Re: [R] Da

Re: [R] Date Time in R

2016-07-26 Thread Tom Wright
<r-help@r-project.org> *Subject:* Re: [R] Date Time in R Hello Tom, Please find the details: (i have changed name from eir to a1, rest all is same) str(a1$date) Factor w/ 32 levels "05-30-16","05-31-16",..: 1 1 1 head(a1$date) 05-30-16 05-30-16 05-30-16 05-30-16 05-

Re: [R] Date Time in R

2016-07-26 Thread Shivi Bhatia
016 11:46 AM > To: David L Carlson <dcarl...@tamu.edu> > Cc: r-help <r-help@r-project.org> > Subject: Re: [R] Date Time in R > > Hi David please see the code and some reproducible data: > eir$date<- as.Date(eir$date,format = "%m-%d-%y") then i had used the >

Re: [R] Date Time in R

2016-07-26 Thread Hadley Wickham
u >> created with read.csv() and show the command(s) you used to convert the >> character data to date format. The solution is likely to be simple if you >> will cut/paste the R console and not just describe what is happening. >> >> >> >> David C >> &g

Re: [R] Date Time in R

2016-07-26 Thread Tom Wright
-help-boun...@r-project.org] On Behalf Of Shivi Bhatia Sent: July 26, 2016 11:46 AM To: David L Carlson <dcarl...@tamu.edu> Cc: r-help <r-help@r-project.org> Subject: Re: [R] Date Time in R Hi David please see the code and some reproducible data: eir$date<- as.Date(eir$date,format = &quo

Re: [R] Date Time in R

2016-07-26 Thread Shivi Bhatia
u >> created with read.csv() and show the command(s) you used to convert the >> character data to date format. The solution is likely to be simple if you >> will cut/paste the R console and not just describe what is happening. >> >> >> >> David C >>

Re: [R] Date Time in R

2016-07-26 Thread Shivi Bhatia
d with read.csv() and show the command(s) you used to convert the > character data to date format. The solution is likely to be simple if you > will cut/paste the R console and not just describe what is happening. > > > > David C > > > > *From:* Shivi Bhatia [mailto

Re: [R] Date Time in R

2016-07-26 Thread Nordlund, Dan (DSHS/RDA)
om: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Shivi > Bhatia > Sent: Tuesday, July 26, 2016 4:43 AM > To: Duncan Murdoch > Cc: r-help@r-project.org > Subject: Re: [R] Date Time in R > > Thanks Duncan for the quick response. I will check again as you sugg

Re: [R] Date Time in R

2016-07-26 Thread David L Carlson
will cut/paste the R console and not just describe what is happening. David C From: Shivi Bhatia [mailto:shivipm...@gmail.com] Sent: Tuesday, July 26, 2016 10:08 AM To: David L Carlson Subject: Re: [R] Date Time in R Hi David, This gives the results accurately. The first line shows all the variable

Re: [R] Date Time in R

2016-07-26 Thread David L Carlson
Anthropology Texas A University College Station, TX 77840-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Shivi Bhatia Sent: Tuesday, July 26, 2016 7:42 AM To: Marc Schwartz Cc: R-help Subject: Re: [R] Date Time in R Thanks Marc for the help. this re

Re: [R] Date Time in R

2016-07-26 Thread Shivi Bhatia
Thanks Marc for the help. this really helps. I think there is some issue with the data saved in csv format for this variable as when i checked: str(eir$date)- this results in :- Date[1:5327], format: NA NA NA NA NA. Thanks again. On Tue, Jul 26, 2016 at 5:58 PM, Marc Schwartz

Re: [R] Date Time in R

2016-07-26 Thread Marc Schwartz
Hi, That eir$date might be a factor is irrelevant. There is an as.Date() method for factors, which does the factor to character coercion internally and then calls as.Date.character() on the result. Using the example data below: eir <- data.frame(date = c("05-30-16", "05-30-16", "05-30-16",

Re: [R] Date Time in R

2016-07-26 Thread Shivi Bhatia
Hello Again, While i tried your solution as you suggested above it seems to be working. Here is the output temp<- dput(head(eir$date)) c("05-30-16", "05-30-16", "05-30-16", "05-30-16", "05-30-16", "05-30-16") however it still shows class(eir$date) as character and hence i cannot find weekdays

Re: [R] Date Time in R

2016-07-26 Thread Shivi Bhatia
Thanks Duncan for the quick response. I will check again as you suggested. If that doesn't work i will share a reproducible example. Thanks again On Tue, Jul 26, 2016 at 4:43 PM, Duncan Murdoch wrote: > On 26/07/2016 7:05 AM, Shivi Bhatia wrote: > >> Hi Team, >>

Re: [R] Date Time in R

2016-07-26 Thread Duncan Murdoch
On 26/07/2016 7:05 AM, Shivi Bhatia wrote: Hi Team, This scenario may have come across a number of times however i checked nabble & SO and couldn't find a solution hence request assistance. I have a date variable in my data-set eir. The class of this var was character while i had read the file

[R] Date Time in R

2016-07-26 Thread Shivi Bhatia
Hi Team, This scenario may have come across a number of times however i checked nabble & SO and couldn't find a solution hence request assistance. I have a date variable in my data-set eir. The class of this var was character while i had read the file in r studio. Example of date - 05-30-16 To

Re: [R] date time manipulation- R 2.15.1 windows 7

2013-03-18 Thread yash kajaria
week(ymd(date2)) # 1 parsed with %Y-%m-%d #[1] 4 A.K. - Original Message - From: yash kajaria yash.kaja...@gmail.com To: r-help@r-project.org Cc: Sent: Thursday, March 14, 2013 9:45 AM Subject: [R] date time manipulation- R 2.15.1 windows 7 Hi, I wanted to learn how to solve

[R] date time manipulation- R 2.15.1 windows 7

2013-03-14 Thread yash kajaria
Hi, I wanted to learn how to solve a date and time manipulation where i can do the following two 1. difference of two dates eg (differnce between 5th jan 2013 and 1st jan 2013) 2.Suppose i have week number of the year, i want to know if i can find out the day it refers to eg( say week

Re: [R] date time manipulation- R 2.15.1 windows 7

2013-03-14 Thread John Kane
] date time manipulation- R 2.15.1 windows 7 Hi, I wanted to learn how to solve a date and time manipulation where i can do the following two 1. difference of two dates eg (differnce between 5th jan 2013 and 1st jan 2013) 2.Suppose i have week number of the year, i want

Re: [R] date time manipulation- R 2.15.1 windows 7

2013-03-14 Thread Gabor Grothendieck
On Thu, Mar 14, 2013 at 9:45 AM, yash kajaria yash.kaja...@gmail.com wrote: Hi, I wanted to learn how to solve a date and time manipulation where i can do the following two 1. difference of two dates eg (differnce between 5th jan 2013 and 1st jan 2013) 2.Suppose i have week

Re: [R] date time manipulation- R 2.15.1 windows 7

2013-03-14 Thread arun
:45 AM Subject: [R] date time manipulation- R 2.15.1 windows 7 Hi,     I wanted to learn how to solve a date and time manipulation where i can do the following two     1. difference of two dates eg (differnce between 5th jan 2013 and 1st jan 2013)     2.Suppose i have week number of the year, i