similar to: how to return "date" part of POSIXct

Displaying 20 results from an estimated 10000 matches similar to: "how to return "date" part of POSIXct"

2004 Aug 19
2
proposed change to [.POSIXct
R developers, The "tzone" attribute is stripped from a POSIXct object when the subscript command is called ("[.POISXct"). This results in dates being printed in the locale specific format after a subscript operation is applied to a POSIXct object which has cause several problems for me in the past. Here is an example of this problem under R 1.9.1: > x <-
2010 Apr 12
2
Excel date to R format
I have searched and tried to read before posting but can find nothing to accomplish change Excel dates in double format to R Can someone please help I have a vector of double like this from Excel. 39965.0004549653 and I want to put them in R such that I can display them in any Date and Time format. as.Date does it ALMOST but chops off the fractional seconds. POSIXct doesn't appear to do
2010 Mar 17
3
Date conversion issue
I am parsing dates as follows: > z[1:10,1:3] V1 V2 V3 1 0 03/02/09 22:20:51.274 2 100 03/02/09 22:28:18.801 3 200 03/02/09 22:33:33.762 4 300 03/02/09 22:40:21.826 5 400 03/02/09 22:41:38.361 6 500 03/02/09 22:42:50.882 7 600 03/02/09 22:45:19.885 8 700 03/02/09 22:48:55.558 9 800 03/02/09 22:51:21.112 10 900 03/02/09 22:58:41.860
2011 May 31
3
DateTime Math in R - POSIXct
Greetings - I'm battling POSIXct, as per the code below. My input is actually an XL file, but the weird results below correctly model what I am seeing in my program. Before I punt and use lubridate or timeDate, could anyone please help me understand why POSIXct forces my variable back to GMT? I suspect that I'm not properly coding the tzone value, but it does not throw an
2008 Feb 16
3
Arithmetic bug? (found when use POSIXct) (PR#10776)
Full_Name: Bo Zhou Version: 2.6.1 (2007-11-26) OS: Windows XP Submission from: (NULL) (207.237.54.242) Hi, I found an arithmetic problem when I'm doing something with POSIXct The code to reproduce it is as follows (This is the recommended way of finding out time zone difference on R News 2004-1 Page 32 URL http://cran.r-project.org/doc/Rnews/Rnews_2004-1.pdf) a=Sys.time()
2009 Mar 04
2
patch for axis.POSIXct (related to timezones)
I am finding that axis.POSIXct uses the local timezone for deciding where to put tic marks, even if the data being plotted are in another time zone. The solution is to use attr() to copy from the 'x' (provided as an argument) to the 'z' (used for the 'at' locations). I have pasted my proposed solution in section 1 below (as a diff). Then, in section 2, I'll put some
2012 Jul 09
1
c(a, b) for POSIXct objects with tzone attributes?
Hello: What is the recommended method for retaining the tzone attributes when concatonating POSIXct objects? > (d1 <- ISOdate(1970,1,1)) # Sets the tzone attribute = GMT [1] "1970-01-01 12:00:00 GMT" > (d1.2 <- c(d1, d1)) # c(..) strips the tzone attribute, displays in the time zone of the operating system [1] "1970-01-01 04:00:00 PST" "1970-01-01
2012 Oct 30
2
POSIXct date missing "time component"
Hi, I have some dates that are giving me a problem, in general the dates look like this: free.dates[60:61] [1] "2009-05-21 23:45:00 GMT" "2009-05-22 00:00:00 GMT" but for some reason, when taken "alone", they look like this: free.dates[60] [1] "2009-05-21 23:45:00 GMT" free.dates[61] [1] "2009-05-22 GMT" # the time component is gone, and
2010 Mar 09
8
Deltas or changes
How can I generate a vector of differences between each elemtn of an vector? i.e. a[i]=x[i]/x[i-1] -- View this message in context: http://n4.nabble.com/Deltas-or-changes-tp1585960p1585960.html Sent from the R help mailing list archive at Nabble.com.
2010 Mar 11
1
Group by
I have a matrix with a POSIXct as a numeric in the first column. I would like to create a new matrix that is "grouped by" my chosed time bars. i.e. So I would like to group by hour or day or 5 days, and have all my columns be summed or averaged or counted.. mydata: V1,V2,V3 10:03:13,3.4,1002 10:03:14,5.6,1001 10:05:27,7.2,999 10:05:33,8.2,998 I want to convert this into say 5
2013 Aug 22
1
From POSIXct to numeric and back with time zone
From POSIXct to numeric and back with time zone I am running regressions on data which has time series with different time resolution. Some data has hourly resolution, while most has either daily or weekly resolution. Aggregation is used to make the hourly data daily, while liner interpolation is used to find daily data from the weekly time series. This data manipulation requires some careful
2004 Aug 17
3
Fwd: strptime() problem?
Hi all; I've already send a similar e-mail to the list and Prof. Brian Ripley answered me but my doubts remain unresolved. Thanks for the clarification, but perhaps I wasn't clear enough in posting my questions. I've got a postgres database which I read into R. The first column is Timestamp with timezone, and my data are already in UTC format. An 'printed' extract of R
2006 Oct 27
2
POSIXct time zone and daylight savings issues
Hello, Suppose we need a function that takes a POSIXct object and need to calculate the time difference between it and GMT time: gmtDiff <- function(time) { time.gmt <- as.POSIXct(format(time, tz="GMT")) time.plt <- as.POSIXlt(time) dlstime <- ifelse(time.plt$isdst > 0, 1, 0) timezone <- as.numeric(difftime(time, time.gmt, units="hours"))
2010 Mar 11
6
tm[,-1]
This does what I was hoping it would: aggregate(tm[,-1],by=list(tm[,10]),FUN="mean") but I don't know what "tm[,-1]" means (well - the -1 bit anyway. Does it somehow means the whole matrix? Please don't tell me to check the manual - I tried and failed dismally... -- View this message in context: http://n4.nabble.com/tm-1-tp1588804p1588804.html Sent from the R
2012 Aug 09
1
POSIXct to ts
Hi, I have a dataframe (try.1) with  date/time and temperature columns, and the date/time is in POSIXct fomat. Sample included below. I would like to to try decompose () or stl() to look at the trends and seasonality in my data, eventually so that  I can  look at autocorrelation.  The series is 3 years of water temperature with clearly visible seasonal periods. Right now, if I try decompose,
2006 Nov 09
1
POSIXlt converted to POSIXct in as.data.frame()
In trying to use as.Date(), I've come across the conversion of POSIXlt to POSIXct when a POSIXlt variable is included in a data frame: my_POSIX <- strptime(c("11-09-2006", "11-10-2006", "11-11-2006", "11-12-2006", "11-13-2006"), "%m-%d-%Y") str(my_POSIX) my_Date <- as.Date(my_POSIX) str(my_Date) data <- format(my_Date)
2011 Jan 07
1
POSIXct issue
Hello I have trouble getting my original datetime back see below. I hope I am missing something. Please help. > tt <- as.POSIXct("2011-01-07 07:49:13", tz="EST") > tt [1] "2011-01-07 07:49:13 EST" > ttn <- as.numeric(tt) > ttn [1] 1294404553 > tt <- as.POSIXct(ttn,origin='1970-01-01',tz="EST") > tt [1] "2011-01-07
2010 Sep 03
1
Incorrect formatted output after subtracting non-integer seconds from POSIXt origin
> x<-as.POSIXct("1970-1-1", tz="UTC")-.5 > y<-as.POSIXct("1970-1-1", tz="UTC")+.5 > x==y [1] FALSE # of course but x and y "appear" to be the same when formatted, even with extra precision: > format(x, format="%Y-%m-%d %H:%M:%OS2") [1] "1970-01-01 00:00:00.50" > format(y, format="%Y-%m-%d
2002 May 21
1
I() fails on objects of class POSIXct (PR#1587)
Although the documentation is somewhat sketchy, I() can be used to create objects of class AsIs: > I("a") [1] "a" attr(,"class") [1] "AsIs" "character" > I(4) [1] 4 attr(,"class") [1] "AsIs" "numeric" > I(4 + 0i) [1] 4+0i attr(,"class") [1] "AsIs" "complex" > This
2012 Oct 30
2
changing date by +/- days
Hi, Let say I have a date variable like this: structure(1243792800, class = c("POSIXct", "POSIXt"), tzone = "GMT") [1] "2009-05-31 18:00:00 GMT" How can I make it 10 days prior, so: [1] "2009-05-21 18:00:00 GMT" I'm randomly selecting dates from a list and want a second value a set # of days either before or after. Thanks ahead of time.