[Rd] format Date

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Aug 18 12:24:10 CEST 2008


On Sun, 17 Aug 2008, sayeed hussain wrote:

> Hey people..

Wrong 'people': this is a question for R-help, and please study the 
R posting guide.

> I have been trying this code
>
> write.table(data.frame(date,name,amount,details),file="C:/Documents and
> Settings/Administrator/My Documents/Account/Account
> Info.txt",quote=FALSE,append=TRUE,col.names=FALSE,row.names=FALSE,sep="\t")
>
> check<-read.table("C:/Documents and Settings/Administrator/My
> Documents/Account/Account
> Info.txt",col.names=c("Date","Name","Amount","Details"),header=FALSE,sep="\t",
> na.strings="NA")
>
> #My na.strings="NA" is not showing NA's in blank entries

It is not documented to.

> # check$Date is of the format("%Y-%m-%d")

Really?  I think most likely it is a character string.

> # I want to change it to
>
> check$Date<-format(check$Date,"%d-%m-%Y")
>
> #  I get this error
>
> Error in switch(mode(x), "NULL" = "NULL", character = .Internal(format(x,  :
>
> invalid 'trim' argument

Did you read ?format: trim is the second argument, and this is not a 
valid value.

>
> HELP

So, please read the posting guide and post a complete reproducible example 
there.  Then people may be prepared to help you, if they believe you have 
made a reasonable effort to help yourself.

> Sayeed
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list