Hi,

I am getting my results from the following:

*z$Date<-as.Date(as.character(z$Date),format="%d/%m/%y")*

instead of:

z$Date<-as.Date(as.character(z$Date,format="%d/%m/%y"))

Thanks again.

Regards
Vikram


On Mon, Oct 10, 2011 at 4:08 PM, Jeff Newmiller <jdnewmil@dcn.davis.ca.us>wrote:

> Convert to character first or use the "as.is" option to read.csv. The
> default is to try to convert the underlying integer form of factors to date,
> which is not what you intend.
> ---------------------------------------------------------------------------
> Jeff Newmiller The ..... ..... Go Live...
> DCN:<jdnewmil@dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
> Live: OO#.. Dead: OO#.. Playing
> Research Engineer (Solar/Batteries O.O#. #.O#. with
> /Software/Embedded Controllers) .OO#. .OO#. rocks...1k
> ---------------------------------------------------------------------------
>
> Sent from my phone. Please excuse my brevity.
>
> Vikram Bahure <economics.vikram@gmail.com> wrote:
>>
>> Dear R users,
>>
>> I have an elementary query.
>>
>> I have a dataset which is taken from text file with the help of read.csv
>> command but when I generate the data in R file it converts the Dates into
>> factor.So for the above problem, I use as.Date to convert the Dates from
>> factor form to date format using the following: z has Date as a column.
>>
>> *z<- read.csv("data", header = TRUE, sep = "\t")
>>
>> z$Date<- as.Date(z$Date, format = "%d/%m/%y/")
>>
>> *But during this operation I loose all my dates and I get NA's instead of
>>
>> it.
>>
>> It would be helpful to have your inputs.
>>
>> Regards
>> Vikram
>>
>> 	[[alternative HTML version deleted]]
>>
>> ------------------------------
>>
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the post
>>  ing
>> guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>

	[[alternative HTML version deleted]]

