>>
>>>>> > So this looks correct so far.
>>>>> >
>>>>> >
>>>>> >
>>>>> > # convert strings (or factors) to a date object
>>>>> >
>>>>> > a1$date <- as.Date(a1$date, “%m-%d-%y”)
>
)
>>>> >
>>>> >
>>>> >
>>>> > # Note the date object is now displayed in the format %Y-%m-%d by
>>>> default
>>>> >
>>>> > # so no need for the mdy() or ymd() function
>>>> >
>>
; # so no need for the mdy() or ymd() function
>>> >
>>> >
>>> >
>>> > # extract the weekdays as number
>>> >
>>> > weekdays <- wday(a1$date)
>>> >
>>> >
>>> >
>>> > #
y(a1$date)
>> >
>> >
>> >
>> > # note can’t have spaces in variable names
>> >
>> > week_names <- wday(a1$date, label=TRUE)
>> >
>> >
>> >
>> >
>> >
>> > *From:* Shivi Bhatia [mail
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 <
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
<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-
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
>
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
-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
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
>>
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
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
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 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
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
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
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,
>>
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
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
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
] 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
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
: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
26 matches
Mail list logo