>>>> >
>>>>> > # convert strings (or factors) to a date object
>>>>> >
>>>>> > a1$date <- as.Date(a1$date, “%m-%d-%y”)
>>>>> >
>>>>> >
>>>>> >
>>>>> > # No
>
>>>> >
>>>> > Please find the details: (i have changed name from eir to a1, rest
>>>> all is
>>>> > same)
>>>> >
>>>> >
>>>> >
>>>> > str(a1$date)
>>>> >
>>&
;>> >
>>> > # extract the weekdays as number
>>> >
>>> > weekdays <- wday(a1$date)
>>> >
>>> >
>>> >
>>> > # note can’t have spaces in variable names
>>> >
>>> > week_names <- wda
by
>> default
>> >
>> > # so no need for the mdy() or ymd() function
>> >
>> >
>> >
>> > # extract the weekdays as number
>> >
>> > weekdays <- wday(a1$date)
>> >
>> >
>> >
>> >
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
> > *Cc:* David L Carlson ; r-help
>
gt;
>
>
> *From:* Shivi Bhatia [mailto:shivipm...@gmail.com]
> *Sent:* July 26, 2016 12:16 PM
> *To:* Tom Wright
> *Cc:* David L Carlson ; r-help
>
> *Subject:* Re: [R] Date Time in R
>
>
>
> Hello Tom,
>
>
>
> Please find the details: (i have change
- wday(a1$date)
# 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
*Cc:* David L Carlson ; r-help
*Subject:* Re: [R] Date Time in R
Hello Tom,
Please
rmation before doing any processing on the date
> (i.e. before the as.Date() function) we may be able to help.
>
>
>
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Shivi
> Bhatia
> Sent: July 26, 2016 11:46 AM
> To: David L Ca
; relevant in this context.
>
> On Tue, Jul 26, 2016 at 8:55 PM, David L Carlson wrote:
>
>> Show us the output, don’t just tell us what you are seeing. If the dates
>> are correct in the csv file, show us the structure of the data frame you
>> created with read.csv() an
-help-boun...@r-project.org] On Behalf Of Shivi Bhatia
Sent: July 26, 2016 11:46 AM
To: David L Carlson
Cc: r-help
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
lubridate li
n this context.
>
> On Tue, Jul 26, 2016 at 8:55 PM, David L Carlson
> wrote:
>
>> Show us the output, don’t just tell us what you are seeing. If the dates
>> are correct in the csv file, show us the structure of the data frame you
>> 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
>
>
>
> *From:* Shivi Bhatia [mailto:shivipm...@gmail.com]
>
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 suggested
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
Anthropology
Texas A&M 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. thi
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 wrote:
> Hi,
>
> T
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",
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 from
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,
>>
>> This scenario may have co
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
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 c
21 matches
Mail list logo