Change this line to :

>pose$CREATED.DATE=as.Date(pose$CREATED.DATE,"%d/%m/%Y") # mind the capital
Y
>pose
  DESCRIPTION CREATED.DATE QUANITY CLOSING.PRICE
1 COTTON NO.2 Jul/10   2010-05-13       1       81.2000
2 COTTON NO.2 Jul/10   2010-05-13       1       81.2000
3   PALLADIUM Jun/10   2010-05-14      -1      503.6000
4   PALLADIUM Jun/10   2010-05-14      -1      503.6000
5 SUGAR NO.11 Jul/10   2010-05-10       1       13.8900
6 SUGAR NO.11 Jul/10   2010-05-10       1       13.8900

Cheers
Joris

On Tue, Jun 1, 2010 at 5:57 PM, arnaud Gaboury <arnaud.gaboury@gmail.com>wrote:

> Dear group,
>
> Here is my df (obtained with a read.csv2()):
>
>
> df <-
> structure(list(DESCRIPTION = c("COTTON NO.2 Jul/10", "COTTON NO.2 Jul/10",
> "PALLADIUM Jun/10", "PALLADIUM Jun/10", "SUGAR NO.11 Jul/10",
> "SUGAR NO.11 Jul/10"), CREATED.DATE = c("13/05/2010", "13/05/2010",
> "14/05/2010", "14/05/2010", "10/05/2010", "10/05/2010"), QUANITY = c(1,
> 1, -1, -1, 1, 1), CLOSING.PRICE = c("81.2000", "81.2000", "503.6000",
> "503.6000", "13.8900", "13.8900")), .Names = c("DESCRIPTION",
> "CREATED.DATE", "QUANITY", "CLOSING.PRICE"), row.names = c(NA,
> 6L), class = "data.frame")
>
> > str(df)
> 'data.frame':   6 obs. of  4 variables:
>  $ DESCRIPTION  : chr  "COTTON NO.2 Jul/10" "COTTON NO.2 Jul/10" "PALLADIUM
> Jun/10" "PALLADIUM Jun/10" ...
>  $ CREATED.DATE : chr  "13/05/2010" "13/05/2010" "14/05/2010" "14/05/2010"
> ...
>  $ QUANITY      : num  1 1 -1 -1 1 1
>  $ CLOSING.PRICE: chr  "81.2000" "81.2000" "503.6000" "503.6000" ...
>
> I want to change the class of df$CREATED.DATE from Chr to Date:
>
>
> >pose$CREATED.DATE=as.Date(pose$CREATED.DATE,"%d/%m/%y")
>
> Here is what I get :
>
> df <-
> structure(list(DESCRIPTION = c("COTTON NO.2 Jul/10", "COTTON NO.2 Jul/10",
> "PALLADIUM Jun/10", "PALLADIUM Jun/10", "SUGAR NO.11 Jul/10",
> "SUGAR NO.11 Jul/10"), CREATED.DATE = structure(c(18395, 18395,
> 18396, 18396, 18392, 18392), class = "Date"), QUANITY = c(1,
> 1, -1, -1, 1, 1), CLOSING.PRICE = c("81.2000", "81.2000", "503.6000",
> "503.6000", "13.8900", "13.8900")), .Names = c("DESCRIPTION",
> "CREATED.DATE", "QUANITY", "CLOSING.PRICE"), row.names = c(NA,
> 6L), class = "data.frame")
>
> Where does the problem comes from?? Maybe from my sytem date ??
>
> TY for any help
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Joris Meys
Statistical Consultant

Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

Coupure Links 653
B-9000 Gent

tel : +32 9 264 59 87
Joris.Meys@Ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

	[[alternative HTML version deleted]]

