Re: [R] as.Date and ylim in empty plot: RESOLVED

2018-09-22 Thread David Winsemius
> On Sep 19, 2018, at 10:48 PM, Ogbos Okike wrote: > > Hi David, > That's it!!! The outcome is attached. The explanation for this is that columns that have digits separated by dashes will not be interpreted by R's read.table() as numeric or dates, but rather as the default for text entries:

Re: [R] as.Date and ylim in empty plot: RESOLVED

2018-09-19 Thread Ogbos Okike
Hi David, That's it!!! The outcome is attached. Many thanks please. Best Ogbos On Wed, Sep 19, 2018 at 11:34 PM David Winsemius wrote: > > > On Sep 19, 2018, at 7:55 AM, Ogbos Okike > wrote: > > > > Dear Experts, > > I generated the plot attached. Every other thing is OK except the black > >

Re: [R] as.Date and ylim in empty plot

2018-09-19 Thread David Winsemius
> On Sep 19, 2018, at 7:55 AM, Ogbos Okike wrote: > > Dear Experts, > I generated the plot attached. Every other thing is OK except the black > horizontal lines which should appear like points or dots as the coloured > ones. I can't understand why. > > I tried to change it to look like dots by

Re: [R] as.Date and ylim in empty plot

2018-09-19 Thread MacQueen, Don via R-help
I'm a little surprised at some of what happens, but you can get date labels on the x axis like this: drng <- as.Date( c('2005-1-1' , '2005-12-31') ) plot(1, type="n", xlab="", ylab="", xaxt='n', xlim=drng, ylim=c(-.5, -10)) axis(1, at= pretty(drng), lab=format(pretty(drng))) and if you prefer

[R] as.Date and ylim in empty plot

2018-09-19 Thread Ogbos Okike
Dear Experts, I generated the plot attached. Every other thing is OK except the black horizontal lines which should appear like points or dots as the coloured ones. I can't understand why. I tried to change it to look like dots by calling empty plots so that I will add them as points. Since I

Re: [R] as.Date() function

2018-08-21 Thread John Kane via R-help
You loaded "lubridate" so using Erin's approach library(lubridate) st <- c("1961-01","1961-04","1983-02") dat1 <- ymd(paste( st, "01",  sep ="-")) On Monday, August 20, 2018, 1:15:56 a.m. EDT, wrote: Thanks Erin and Jim. You have indeed solved my problem. Philip Quoting Erin

Re: [R] as.Date() function

2018-08-21 Thread Erin Hodgess
Nice one! On Tue, Aug 21, 2018 at 6:14 PM John Kane wrote: > You loaded "lubridate" so using Erin's approach > > library(lubridate) > st <- c("1961-01","1961-04","1983-02") > dat1 <- ymd(paste( st, "01", sep ="-")) > > > On Monday, August 20, 2018, 1:15:56 a.m. EDT, < >

Re: [R] as.Date() function

2018-08-19 Thread philipsm
Thanks Erin and Jim. You have indeed solved my problem. Philip Quoting Erin Hodgess : Hi Philip: Here is something to consider: #potential solution: sta <- paste(st,"-01",sep="") st1 <- as.Date(sta, format=("%Y-%m-%d")) print(st1) [1] "1961-01-01" "1961-04-01" "1983-02-01" Hope this

Re: [R] as.Date() function

2018-08-19 Thread Jim Lemon
Hi Phillip, Jose has the correct answer. You probably missed this sentence in the "Note" section of the help page: "If the date string does not specify the date completely, the returned answer may be system-specific." In your case, the function throws up its hands and returns NA as you haven't

Re: [R] as.Date() function

2018-08-19 Thread José María Mateos
On Sun, Aug 19, 2018 at 05:20:29PM -0400, phili...@cpanel1.stormweb.net wrote: > Why the heck am I getting three NAs instead of three Dates?I have > studied the R documentation for as.Date() and it has not turned on > the light bulb for me. I haven't encountered this problem before, but in my

Re: [R] as.Date() function

2018-08-19 Thread Erin Hodgess
Hi Philip: Here is something to consider: > #potential solution: > sta <- paste(st,"-01",sep="") > st1 <- as.Date(sta, format=("%Y-%m-%d")) > print(st1) [1] "1961-01-01" "1961-04-01" "1983-02-01" Hope this helps! Erin Erin Hodgess, PhD mailto: erinm.hodg...@gmail.com On Sun, Aug 19, 2018 at

[R] as.Date() function

2018-08-19 Thread philipsm
I am having trouble with what must be a very simple problem. Here is a reproducible example: library(lubridate) st <- c("1961-01","1961-04","1983-02") print(st) #[1] "1961-01" "1961-04" "1983-02" st1 <- as.Date(st, format=("%Y-%m")) print(st1) #[1] NA NA NA Why the heck am I getting three NAs

[R] as.Date and Legend in a plot: Fixed

2018-06-23 Thread Ogbos Okike
Dear List, I am happy to report that the problem is fixed. as.Date("1998-02-10") as suggested by David handled the problem with easy. Many thanks to everybody. as.Date(1998-02-10) really resulted in error. It is my oversight. I really tried many things the day I was working on that and have

Re: [R] as.Date and Legend in a plot

2018-06-22 Thread MacQueen, Don via R-help
What David Winsemius said, plus: Does legend('topleft', c("Climax", "Thule", "Sopo"), lty = 1, col = ("black","red","blue")) not work? It should, which will illustrate that you CAN add a legend to the plot. The x,y that you supply to legend must be values that are within the x,y range of

Re: [R] as.Date and Legend in a plot

2018-06-22 Thread David Winsemius
> On Jun 22, 2018, at 12:12 PM, Ogbos Okike wrote: > > Dear Contributors, > > I am surprised that I cannot add legend to a certain plot. Although the > x-axis indicates years, the actual data was in year, month and day format. > I then used as.Date to play around and get what I am looking

[R] as.Date and Legend in a plot

2018-06-22 Thread Ogbos Okike
Dear Contributors, I am surprised that I cannot add legend to a certain plot. Although the x-axis indicates years, the actual data was in year, month and day format. I then used as.Date to play around and get what I am looking for. I am, however, worried that I cannot add legend to the plot no

Re: [R] as.Date: fixed

2016-04-18 Thread Ogbos Okike
Dear All, Many thanks for bailing me out. Ogbos On Apr 18, 2016 9:07 PM, "David Winsemius" wrote: > > > On Apr 18, 2016, at 10:44 AM, Ogbos Okike > wrote: > > > > Dear ALL, > > Thank you so much for your contributions. > > I have made some

Re: [R] as.Date

2016-04-18 Thread David Winsemius
> On Apr 18, 2016, at 10:44 AM, Ogbos Okike wrote: > > Dear ALL, > Thank you so much for your contributions. > I have made some progress. Below is a simple script I gleaned from > your kind responses: > Sys.setenv(TZ="Etc/GMT") > dates <- c("02/27/92", "02/27/92",

Re: [R] as.Date

2016-04-18 Thread Ogbos Okike
Dear ALL, Thank you so much for your contributions. I have made some progress. Below is a simple script I gleaned from your kind responses: Sys.setenv(TZ="Etc/GMT") dates <- c("02/27/92", "02/27/92", "01/14/92", "02/28/92", "02/01/92") times <- c("23:0:0", "22:0:0", "01:00:00", "18:0:0",

Re: [R] as.Date

2016-04-18 Thread Jeff Newmiller
Date data cannot represent hour data. You need to use POSIXct or perhaps the chron class from the chron package. To use POSIXct, use ISOdatetime instead of ISOdate. Also be careful which timezone you have set as default (in most operating systems calling Sys.setenv(TZ="Etc/GMT") or similar

Re: [R] as.Date

2016-04-18 Thread PIKAL Petr
should also use ISOdatetime conversion function to use hours etc. in your commands. Cheers Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ogbos > Okike > Sent: Monday, April 18, 2016 3:10 PM > To: r-help@r-project.org > Su

Re: [R] as.Date

2016-04-18 Thread peter dalgaard
The most important thing is that Date objects by definition do not include time of day. You want to look at ISOdatetime() and as.POSIXct() instead. And beware daylight savings time issues. -pd On 18 Apr 2016, at 15:09 , Ogbos Okike wrote: > Dear All, > > I have a

[R] as.Date

2016-04-18 Thread Ogbos Okike
Dear All, I have a data set containing year, month, day and counts as shown below: data <- read.table("data.txt", col.names = c("year", "month", "day", "counts")) Using the formula below, I converted the data to as date and plotted. new.century <- data$year < 70 data$year <- ifelse(new.century,

[R] as.Date woes

2014-08-20 Thread Peter Langfelder
Hi all, I have recently started working with Date objects and find the experience unsettling, to put it mildly. The help for as.Date says, in part: ## S3 method for class 'character' as.Date(x, format = , ...) x: An object to be converted. format: A character string. If

Re: [R] as.Date woes

2014-08-20 Thread Peter Langfelder
Never mind... the solution was to read the source code of as.Date.character. It turns out the default format= is meaningless. If 'format' is not given in the call to as.Date, it is NOT assumed to be , and the function gives very different results from a call where the argument format= is given.

[R] as.Date(Sys.time()) returns tomorrow !

2014-06-19 Thread ce
Dear all, Sys.time() [1] 2014-06-19 22:19:17.976818 EDT as.Date(Sys.time()) [1] 2014-06-20 why this happens ? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] as.Date(Sys.time()) returns tomorrow !

2014-06-19 Thread William Dunlap
Is it a time zone issue? I get: R Sys.time() [1] 2014-06-19 20:09:25 PDT R as.Date(Sys.time()) [1] 2014-06-20 R as.Date(Sys.time(),tz=US/Pacific) [1] 2014-06-19 R as.Date(Sys.time(),tz=PDT) [1] 2014-06-20 Warning message: In as.POSIXlt.POSIXct(x, tz = tz) : unknown timezone 'PDT' Bill Dunlap

Re: [R] as.Date(Sys.time()) returns tomorrow !

2014-06-19 Thread ce
[wdun...@tibco.com] Date: 06/19/2014 11:10 PM To: ce zadi...@excite.com CC: r-help@r-project.org Subject: Re: [R] as.Date(Sys.time()) returns tomorrow ! Is it a time zone issue? I get: R Sys.time() [1] 2014-06-19 20:09:25 PDT R as.Date(Sys.time()) [1] 2014-06-20 R as.Date(Sys.time(),tz=US/Pacific) [1

[R] as.Date converts to NA

2014-03-09 Thread Hermann Norpois
Hello, I have some problems with as.Date. strDates - c (01/05/1965, 08/16/1975) dates - as.Date (strDates, %m/%d%/%Y) dates [1] NA NA # I expected my dates. What was going wrong? Thanks Hermann [[alternative HTML version deleted]] __

Re: [R] as.Date converts to NA

2014-03-09 Thread Uwe Ligges
On 09.03.2014 11:34, Hermann Norpois wrote: Hello, I have some problems with as.Date. strDates - c (01/05/1965, 08/16/1975) dates - as.Date (strDates, %m/%d%/%Y) ^ Remove the % after the d. Best, Uwe Ligges dates [1] NA NA # I expected my dates. What

Re: [R] as.Date converts to NA

2014-03-09 Thread Achim Zeileis
On Sun, 9 Mar 2014, Hermann Norpois wrote: Hello, I have some problems with as.Date. strDates - c (01/05/1965, 08/16/1975) dates - as.Date (strDates, %m/%d%/%Y) Instead of %d% just %d: R as.Date(strDates, %m/%d/%Y) [1] 1965-01-05 1975-08-16 dates [1

Re: [R] as.Date converts to NA

2014-03-09 Thread arun
Hi, Check for the additional % in your code %d%.  as.Date(strDates,%m/%d/%Y) #[1] 1965-01-05 1975-08-16 A.K. On Sunday, March 9, 2014 12:16 PM, Hermann Norpois hnorp...@gmail.com wrote: Hello, I have some problems with as.Date. strDates - c (01/05/1965, 08/16/1975) dates - as.Date (strDates,

[R] as.Date with characters error

2013-07-30 Thread Liz Hare
Hello, I'm trying to convert dates in the format dd-mmm-yy using as.Date. I have two columns like this, and it works on one but not on the other. options(stringsAsFactors=FALSE) ortho - read.csv(test1.csv, header=TRUE, nrows=10) ortho DogID BirthDate xray.date 1 11877 23-Aug-87 15-Feb-88

Re: [R] as.Date with characters error

2013-07-30 Thread arun
Hi, Did you checked after removing e from formate? ortho$test.dat - as.Date(ortho$xray.date, formate=%d-%b-%y)   A.K. - Original Message - From: Liz Hare dogg...@earthlink.net To: r-help@r-project.org Cc: Sent: Tuesday, July 30, 2013 12:00 PM Subject: [R] as.Date with characters error

Re: [R] as.Date with characters error

2013-07-30 Thread Liz Hare
To: r-help@r-project.org Cc: Sent: Tuesday, July 30, 2013 12:00 PM Subject: [R] as.Date with characters error Hello, I'm trying to convert dates in the format dd-mmm-yy using as.Date. I have two columns like this, and it works on one but not on the other. options(stringsAsFactors=FALSE) ortho

Re: [R] as.date not reading Hour/Minute am/pm Data

2013-04-15 Thread arun
Hi, Try: x- c(2/26/13 11:59 PM, 2/25/13 10:25 AM) strptime(x,%m/%d/%y %I:%M %p) #[1] 2013-02-26 23:59:00 2013-02-25 10:25:00 #or library(lubridate) parse_date_time(x,%m/%d/%y %I:%M %p) # 2 parsed with %m/%d/%y %I:%M %p #[1] 2013-02-26 23:59:00 UTC 2013-02-25 10:25:00 UTC A.K. I'm a newbie to

[R] as.Date to as.POSIXct

2012-12-25 Thread Antonio Rodriges
Hello, I have converted some UNIX time stamps with as.Date as follows dates_unix - seq( as.Date(convertTimeToString(timeStart)), length = length(data), by=1 mon) and now I would like to convert dates_unix from type Date

Re: [R] as.Date to as.POSIXct

2012-12-25 Thread arun
Hi, You should have provided a reproducible example. To convert in general, ?as.POSIXct() A.K. - Original Message - From: Antonio Rodriges antonio@gmail.com To: r-help@r-project.org Cc: Sent: Tuesday, December 25, 2012 7:28 AM Subject: [R] as.Date to as.POSIXct Hello, I have

[R] as.date: do not know how to convert 'test[1]' to class Date

2012-08-01 Thread algotr8der
I have an object, which I pull in from a csv file here http://r.789695.n4.nabble.com/file/n4638691/jan_2011.csv jan_2011.csv mydata - read.csv(jan_2011.csv, header=TRUE, sep=,) head(mydata) Delivery.Date Hour.Ending Repeated.Hour.Flag Settlement.Point Settlement.Point.Price 101/01/2011

Re: [R] as.date: do not know how to convert 'mydata[1]' to class Date

2012-08-01 Thread Ricardogg
For me it owrks when i write it like: as.Date(paste(mydata$Delivery.Date), %m/%d/%Y) Hope it works, Regards, Ricardo -- View this message in context: http://r.789695.n4.nabble.com/as-date-do-not-know-how-to-convert-mydata-1-to-class-Date-tp4638691p4638696.html Sent from the R help mailing

Re: [R] as.date: do not know how to convert 'mydata[1]' to class Date

2012-08-01 Thread algotr8der
Thank you Ricardogg and Arun. I don't know how I missed that. Too many sleepless nights perhaps. Thank you. -- View this message in context: http://r.789695.n4.nabble.com/as-date-do-not-know-how-to-convert-mydata-1-to-class-Date-tp4638691p4638708.html Sent from the R help mailing list archive

Re: [R] as.date: do not know how to convert 'test[1]' to class Date

2012-08-01 Thread R. Michael Weylandt
Please don't post files to nabble in the future -- when Nabble removes them, we then have a broken link in the real archives: dput() is much preferred way to send data. Anyways: # mydata - read.csv(http://r.789695.n4.nabble.com/file/n4638691/jan_2011.csv;) # # dput(head(mydata, 15))

Re: [R] as.date: do not know how to convert 'test[1]' to class Date

2012-08-01 Thread Rui Barradas
Hello, Try reading the data file with stringsAsFactors = FALSE, like this you don't have character vectors, you have factors, which are coded as consecutive integers 1, 2, etc. ?read.table ?read.csv See in particular the argument above, stringsAsFactors Hope this helps, Rui Barradas Em

Re: [R] as.Date error

2011-04-18 Thread David Winsemius
On Apr 17, 2011, at 7:24 PM, Wonjae Lee wrote: Thank you for replying the as.Date error question. I have one more question as below. I used cbind command, and data x changed, 2010-11-16 to 14929, 2010-11-17 to 14930. What happened to them? What should I do to see -mm-dd format data?

[R] as.Date function error

2011-04-17 Thread Wonjae Lee
Hi, I have some problems with as.Date function. After I applied as.Date for my data, 2010 changed to 2020 as below Where am I wrong? Thanks Wonjae x=c(11/16/2010,11/17/2010,11/18/2010,11/19/2010) x=as.Date(x,%m/%d/%y) x [1] 2020-11-16 2020-11-17 2020-11-18 2020-11-19 my R veision is

Re: [R] as.Date function error

2011-04-17 Thread Dennis Murphy
as.Date(x,%m/%d/%Y) [1] 2010-11-16 2010-11-17 2010-11-18 2010-11-19 Notice the Y (four digit date). Dennis On Sun, Apr 17, 2011 at 6:34 AM, Wonjae Lee wjlee2...@naver.com wrote: Hi, I have some problems with as.Date function. After I applied as.Date for my data, 2010 changed to 2020 as

Re: [R] as.Date function error

2011-04-17 Thread Achim Zeileis
On Sun, 17 Apr 2011, Wonjae Lee wrote: Hi, I have some problems with as.Date function. After I applied as.Date for my data, 2010 changed to 2020 as below Where am I wrong? You used %y (two-digit year, here: 20 and then expanded to 2020) instead of %Y (four-digit year, here 2010). Using

[R] as.Date error

2011-04-17 Thread Wonjae Lee
Thank you for replying the as.Date error question. I have one more question as below. I used cbind command, and data x changed, 2010-11-16 to 14929, 2010-11-17 to 14930. What happened to them? What should I do to see -mm-dd format data? x=c(11/16/2010,11/17/2010,11/18/2010,11/19/2010)

Re: [R] as.Date

2011-02-09 Thread Valeri Fabio
-project.org Subject: Re: [R] as.Date Thanks for the reply. The original test was without the quote. The quote come into play when I try to solve this problem changing from to '. However, after restarting my PC the as.Date(36525, origin=1900-01-01) gaves me the correct output [1] 2000-01-02 After

Re: [R] as.Date

2011-02-09 Thread Philipp Pagel
On Wed, Feb 09, 2011 at 08:44:30AM +0100, Valeri Fabio wrote: Hello, I find out which package disturbs as.Date(). It is the package Epi: as.Date(36525, origin=1900-01-01) [1] 2000-01-02 library(Epi) as.Date(36525, origin=1900-01-01) [1] 2070-01-01 detach(package:Epi)

Re: [R] as.Date

2011-02-09 Thread Prof Brian Ripley
And I am hereby reporting this bug to the package maintainer. On Wed, 9 Feb 2011, Philipp Pagel wrote: On Wed, Feb 09, 2011 at 08:44:30AM +0100, Valeri Fabio wrote: Hello, I find out which package disturbs as.Date(). It is the package Epi: as.Date(36525, origin=1900-01-01) [1] 2000-01-02

Re: [R] as.Date

2011-02-09 Thread BXC (Bendix Carstensen)
. februar 2011 11:48 To: Philipp Pagel Cc: BXC (Bendix Carstensen); r-help@r-project.org Subject: Re: [R] as.Date And I am hereby reporting this bug to the package maintainer. On Wed, 9 Feb 2011, Philipp Pagel wrote: On Wed, Feb 09, 2011 at 08:44:30AM +0100, Valeri Fabio wrote: Hello

[R] as.Date

2011-02-08 Thread Valeri Fabio
Hi everybody, I have a strange behavior of the as.Date() function. For example: as.Date(36525, origin=1900-01-01') I would expect to get 2000-01-01. But R gives me [1] 2070-01-01 I tried with several origins but the results are still the same. It seems that the origin does not

Re: [R] as.Date

2011-02-08 Thread David Winsemius
On Feb 8, 2011, at 11:15 AM, Valeri Fabio wrote: Hi everybody, I have a strange behavior of the as.Date() function. No, you have a programming error. For example: as.Date(36525, origin=1900-01-01') You have a superfluous ' as.Date(36525, origin=1900-01-01) [1] 2000-01-02 I

Re: [R] as.Date

2011-02-08 Thread Philipp Pagel
I have a strange behavior of the as.Date() function. For example: as.Date(36525, origin=1900-01-01') I would expect to get 2000-01-01. But R gives me That's almost exactly what I get with R 2.11.1, LINUX (minus the one-day differnce which is probably correct, too lazy to count leap

Re: [R] as.Date

2011-02-08 Thread Prof Brian Ripley
On Tue, 8 Feb 2011, Philipp Pagel wrote: I have a strange behavior of the as.Date() function. For example: as.Date(36525, origin=1900-01-01') I would expect to get 2000-01-01. But R gives me That's almost exactly what I get with R 2.11.1, LINUX (minus the one-day differnce which is probably

Re: [R] as.Date

2011-02-08 Thread Valeri Fabio
Pagel Cc: r-help@r-project.org Subject: Re: [R] as.Date On Tue, 8 Feb 2011, Philipp Pagel wrote: I have a strange behavior of the as.Date() function. For example: as.Date(36525, origin=1900-01-01') I would expect to get 2000-01-01. But R gives me That's almost exactly what I get with R 2.11.1

[R] as.Date() add a day to a date

2010-09-13 Thread Andrew Yee
I'm trying to understand why as.Date() is converting a the modified date of a file from August 22 to August 23. foo - file.info(file.to.process) str(foo) 'data.frame': 1 obs. of 10 variables: $ size : num 5.37e+09 $ isdir : logi FALSE $ mode :Class 'octmode' int 436 $ mtime :

Re: [R] as.Date() add a day to a date

2010-09-13 Thread David Winsemius
On Sep 13, 2010, at 11:56 AM, Andrew Yee wrote: I'm trying to understand why as.Date() is converting a the modified date of a file from August 22 to August 23. foo - file.info(file.to.process) str(foo) 'data.frame': 1 obs. of 10 variables: $ size : num 5.37e+09 $ isdir : logi FALSE $

Re: [R] as.Date() add a day to a date

2010-09-13 Thread Andrew Yee
Thanks David, now I wonder how you can have as.Date() render the date using local time rather than UTC. Andrew On Mon, Sep 13, 2010 at 12:08 PM, David Winsemius dwinsem...@comcast.netwrote: On Sep 13, 2010, at 11:56 AM, Andrew Yee wrote: I'm trying to understand why as.Date() is converting

Re: [R] as.Date() add a day to a date

2010-09-13 Thread David Winsemius
On Sep 13, 2010, at 1:24 PM, Andrew Yee wrote: Thanks David, now I wonder how you can have as.Date() render the date using local time rather than UTC. Since we are both in the EDT TZ at the moment, our times are UTC-4 (hours = 60*60 seconds) dt - as.POSIXct(2010-08-22 23:14:52)

Re: [R] as.Date() add a day to a date

2010-09-13 Thread Andrew Yee
Henrique, thanks for your suggestion. For my applications, character would have been sufficient, so your suggestion of using format() works fine too. Perhaps I should submit a feature request for as.Date() to let you specify local time. Thanks, Andrew On Mon, Sep 13, 2010 at 2:06 PM, Henrique

Re: [R] as.Date() add a day to a date

2010-09-13 Thread David Winsemius
Try this: format(dt, '%Y-%m-%d'), if you want Date class: as.Date(format(dt, '%Y-%m-%d')) On Mon, Sep 13, 2010 at 2:24 PM, Andrew Yee y...@post.harvard.edu wrote: Thanks David, now I wonder how you can have as.Date() render the date using local time rather than UTC. Andrew On Mon,

[R] as.date

2010-06-01 Thread arnaud Gaboury
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,

Re: [R] as.date

2010-06-01 Thread Erik Iverson
Where does the problem comes from?? Maybe from my sytem date ?? Simply from not reading the options carefully enough, from ?strptime, ‘%y’ Year without century (00-99). If you use this on input, which century you get is system-specific. So don't! Most often values

Re: [R] as.date

2010-06-01 Thread Joshua Wiley
Hello, The lowercase 'y' is year without century. This should work for you: as.Date(x=df$CREATED.DATE, format=%d/%m/%Y) HTH, Josh On Tue, Jun 1, 2010 at 8:57 AM, arnaud Gaboury arnaud.gabo...@gmail.com wrote: Dear group, Here is my df (obtained with a read.csv2()): df -

Re: [R] as.date

2010-06-01 Thread Joris Meys
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

Re: [R] as.date

2010-06-01 Thread arnaud Gaboury
TY for the tip. The lower case is in fact the culprit. -Original Message- From: Erik Iverson [mailto:er...@ccbr.umn.edu] Sent: Tuesday, June 01, 2010 6:05 PM To: arnaud Gaboury Cc: r-help@r-project.org Subject: Re: [R] as.date Where does the problem comes from?? Maybe from

Re: [R] as.Date question

2009-12-24 Thread MAL
00:08 Subject: Re: [R] as.Date question Look at documentation ?as.Date as.Date first represents time in UTC, what gives: as.POSIXlt(zzz1, tz=UTC) HTH 2009/12/20 MAL diver...@univecom.ch: All! This piece of code: zzz1 - as.POSIXct(1999-03-18, tz=CET) zzz2 - as.POSIXlt(1999-03-18, tz=CET

Re: [R] as.Date question

2009-12-24 Thread Linlin Yan
: Re: [R] as.Date question Look at documentation ?as.Date as.Date first represents time in UTC, what gives: as.POSIXlt(zzz1, tz=UTC) HTH 2009/12/20 MAL diver...@univecom.ch: All! This piece of code: zzz1 - as.POSIXct(1999-03-18, tz=CET) zzz2 - as.POSIXlt(1999-03-18, tz=CET) zzz1

Re: [R] as.Date question

2009-12-24 Thread Gabor Grothendieck
zzz1 is POSIXct so looking at: as.Date.POSIXct function (x, ...) { z - floor(unclass(x)/86400) attr(z, tzone) - NULL structure(z, class = Date) } environment: namespace:base we see as.Date.POSIXct takes the POSIXct object, zzz1, and converts it to Date relative to GMT. There is no

Re: [R] as.Date question

2009-12-23 Thread Marek Janad
Look at documentation ?as.Date as.Date first represents time in UTC, what gives: as.POSIXlt(zzz1, tz=UTC) HTH 2009/12/20 MAL diver...@univecom.ch: All! This piece of code: zzz1 - as.POSIXct(1999-03-18, tz=CET) zzz2 - as.POSIXlt(1999-03-18, tz=CET) zzz1 == zzz2 as.Date(zzz1)

Re: [R] as.Date question

2009-12-21 Thread Felix Andrews
I don't know the details of why this is happening, but in any case it is a good idea to round() your times if you want to convert them to dates. Just as you would round() a numeric value to convert it to an integer. as.Date(round(zzz1, days)) 2009/12/21 Jason Morgan jwm-r-h...@skepsi.net:

[R] as.Date question

2009-12-20 Thread MAL
All! This piece of code: zzz1 - as.POSIXct(1999-03-18, tz=CET) zzz2 - as.POSIXlt(1999-03-18, tz=CET) zzz1 == zzz2 as.Date(zzz1) as.Date(zzz2) yields TRUE for zzz1==zzz2, but the two dates returned by as.Date are different: as.Date(zzz1) [1] 1999-03-17 as.Date(zzz2) [1] 1999-03-18 I'm using

Re: [R] as.Date question

2009-12-20 Thread Jason Morgan
Hello, On 2009.12.20 18:06:17, MAL wrote: All! This piece of code: zzz1 - as.POSIXct(1999-03-18, tz=CET) zzz2 - as.POSIXlt(1999-03-18, tz=CET) zzz1 == zzz2 as.Date(zzz1) as.Date(zzz2) yields TRUE for zzz1==zzz2, but the two dates returned by as.Date are different:

[R] as.Date question

2009-12-20 Thread MAL
All! This piece of code: zzz1 - as.POSIXct(1999-03-18, tz=CET) zzz2 - as.POSIXlt(1999-03-18, tz=CET) zzz1 == zzz2 as.Date(zzz1) as.Date(zzz2) yields TRUE for zzz1==zzz2, but the two dates returned by as.Date are different: as.Date(zzz1) [1] 1999-03-17 as.Date(zzz2) [1] 1999-03-18 I'm

[R] as.Date from data.frame

2009-11-11 Thread separent
#Hello, #I loaded data using read.table - I needed to convert a row in the data frame to date class: data V1 V2 V3 V4 1 2008-05-19 2008-04-19 2008-03-21 2008-02-22 2 38.16999817 30.7008 36.8661 35.18999863 3 37.4754 29.9576 36.4508

Re: [R] as.Date from data.frame

2009-11-11 Thread Steve Lianoglou
Hi, On Nov 11, 2009, at 1:06 PM, separent wrote: #Hello, #I loaded data using read.table - I needed to convert a row in the data frame to date class: data V1 V2 V3 V4 1 2008-05-19 2008-04-19 2008-03-21 2008-02-22 2 38.16999817 30.7008 36.8661

Re: [R] as.Date from data.frame

2009-11-11 Thread Marc Schwartz
On Nov 11, 2009, at 12:06 PM, separent wrote: #Hello, #I loaded data using read.table - I needed to convert a row in the data frame to date class: data V1 V2 V3 V4 1 2008-05-19 2008-04-19 2008-03-21 2008-02-22 2 38.16999817 30.7008 36.8661

Re: [R] as.Date from data.frame

2009-11-11 Thread David Winsemius
On Nov 11, 2009, at 1:06 PM, separent wrote: #Hello, #I loaded data using read.table - I needed to convert a row in the data frame to date class: You _should_ have given the actual code (as the Posting Guide requests), but I would guess that you should have added either as.is=TRUE

Re: [R] as.Date from data.frame

2009-11-11 Thread separent
Hello Gentlemen, All of your answers were helpfull. Indeed, 'as.is=TRUE' or 'stringsAsFactors=FALSE' avoid importing as factors, as it did when I imported the table without specifying anything. However, data frames will not allow different datatypes within a single column, so, for time series, I

[R] as.Date() clarification

2008-07-03 Thread Ron Michael
When I use the code as.Date(0) the I get : 1970-01-01. My question is why it is like that? help file on as.Date seems to give no light on that. Can anyone clarify me?   Regards, Send instant messages to your online friends http://uk.messenger.yahoo.com [[alternative HTML version

Re: [R] as.Date() clarification

2008-07-03 Thread Achim Zeileis
On Thu, 3 Jul 2008, Ron Michael wrote: When I use the code as.Date(0) the I get : 1970-01-01. My question is why it is like that? help file on as.Date seems to give no light on that. Can anyone clarify me? In R, Date objects are stored internally as the number of days since 1970-01-01

Re: [R] as.Date() clarification

2008-07-03 Thread Peter Dalgaard
Ron Michael wrote: When I use the code as.Date(0) the I get : 1970-01-01. My question is why it is like that? help file on as.Date seems to give no light on that. Can anyone clarify me? Which version of R is this? R version 2.7.1 (2008-06-23) ... as.Date(0) Error in as.Date.numeric(0) :

Re: [R] as.Date() clarification

2008-07-03 Thread Martin Maechler
PD == Peter Dalgaard [EMAIL PROTECTED] on Thu, 03 Jul 2008 12:07:41 +0200 writes: [..] PD and the help page has the explanation. [..] PD [By the way, there used to be a way to see the current help pages on the PD web, but I can't remember how.

[R] 'as.Date' conversion of classes POSIX*t (problem/feature)?

2008-07-03 Thread Angel Spassov
Hi, I'm working with objects of classes Date,POSIXlt and POSIXct and still having some Date/Time-related concepts unclear. In the documentation of as.Date one can find: The 'as.Date' methods accept ... 'POSIXlt' and 'POSIXct'. (The last are converted to days by ignoring the time after midnight

Re: [R] 'as.Date' conversion of classes POSIX*t (problem/feature)?

2008-07-03 Thread Gabor Grothendieck
In the development version of R the output changes to: x1 = as.POSIXlt(2008-01-02 00:58:00) x2 = as.POSIXct(2008-01-02 00:58:00) as.Date(x1); as.Date(x2) [1] 2008-01-02 [1] 2008-01-02 R.version.string [1] R version 2.8.0 Under development (unstable) (2008-06-28 r46012) On Thu, Jul 3,

Re: [R] as.date - german date format

2008-01-10 Thread Konga
Hi Terry, thanks for the information, I should know this in advance but I´m not used to case sensitive syntax - thanks Delphi... regards, Eric Will Terry Therneau wrote: Konga wrote: Hi, I have a data.frame with the following variable: $ xx :Factor w/ 66 levels

Re: [R] as.date - german date format

2008-01-09 Thread Uwe Ligges
Konga wrote: Hi, I have a data.frame with the following variable: $ xx :Factor w/ 66 levels 01.02.2006,01.03.2006,..: 3 3 3 3 3 3 3 3 3 now I´d like use as.date on it - if I comprehend the instructions on http://finzi.psych.upenn.edu/R/library/base/html/format.Date.html it should

[R] as.date - german date format

2008-01-09 Thread Konga
Hi, I have a data.frame with the following variable: $ xx :Factor w/ 66 levels 01.02.2006,01.03.2006,..: 3 3 3 3 3 3 3 3 3 now I´d like use as.date on it - if I comprehend the instructions on http://finzi.psych.upenn.edu/R/library/base/html/format.Date.html it should work like this:

Re: [R] as.date - german date format

2008-01-09 Thread Konga
Uwe Ligges-3 wrote: Konga wrote: Hi, I have a data.frame with the following variable: $ xx :Factor w/ 66 levels 01.02.2006,01.03.2006,..: 3 3 3 3 3 3 3 3 3 now I´d like use as.date on it - if I comprehend the instructions on

Re: [R] as.date - german date format

2008-01-09 Thread Uwe Ligges
Konga wrote: Uwe Ligges-3 wrote: Konga wrote: Hi, I have a data.frame with the following variable: $ xx :Factor w/ 66 levels 01.02.2006,01.03.2006,..: 3 3 3 3 3 3 3 3 3 now I´d like use as.date on it - if I comprehend the instructions on

Re: [R] as.date - german date format

2008-01-09 Thread John Kane
Functions to convert between character representations and objects of class Date representing calendar dates. $ xx :Factor w/ 66 levels try as.character(xx) --- Konga [EMAIL PROTECTED] wrote: Hi, I have a data.frame with the following variable: $ xx :Factor w/ 66 levels

Re: [R] as.date - german date format

2008-01-09 Thread Konga
Thanks a lot, it works! Now I have to find out why - but I think I can/should do it on my own ;o) -- View this message in context: http://www.nabble.com/as.date---german-date-format-tp14712654p14728914.html Sent from the R help mailing list archive at Nabble.com.