Displaying 20 results from an estimated 10000 matches similar to: "can't create a POSIXct from an actual Unix timestamp (PR#6975)"
2010 May 25
1
find_by_sql timestamp parameter
Hi
In controller I have this query:
@price_stat = Price.find_by_sql("select id, cost, tour_id,
unix_timestamp(created_at) from prices")
when I try to display result''s created_at column I don''t have any
results:
<% @price_stat.each do |p| %>
<p><%= p.created_at %></p>
<% end %>
result is empty
But if I try without unix_timestamp. ie:
2006 Aug 25
1
How to get back POSIXct format after calculating with hist() results
Hi,
I have a casting/formatting question on hist.POSIXt:
The histogram plot from POSIXct works perfect (with help of Prof. Ripley
-thanks!).
When processing the hist(plot=FALSE) output and then plotting the
results over the x-axis (bins) coming from hist(), I lose the date/time
labels, getting instead integers displayed.
Trying to cast the $breaks with as.POSIXct gives silly results with
2006 Aug 23
1
how to get a histogram of an POSIXct vector ?
Hi,
search on web indicates that R also includes a hist method on POSIXct
vectors.
My (perhaps too unexperienced) approach below yields an error.
Could somebody give me a hint what's wrong ?
Peter
> str(samples)
`data.frame': 7500 obs. of 1 variable:
$ DateTime:'POSIXct', format: chr "2006-07-20 00:10:08" "2006-07-20
00:11:17" "2006-07-20
2004 May 27
2
axis.POSIXct: Datetime data and plotting
I've run into a problem with the datetime axis generated by axis.POSIXct. It appears a similar issue was discussed in October 2003 under the subject line "datetime data and plotting" (see https://stat.ethz.ch/pipermail/r-help/2003-October/039071.html), but I wasn't able to determine whether there is a straightforward solution.
The code below produces a graph with apparently
2005 Apr 30
1
segfault during build of 2.1.0 on RH9; print.POSIXct implicated (PR#7827)
In attempting to build R using
rpmbuild --rebuild R-2.1.0-0.fdr.2.fc3.src.rpm
on a fairly up-to-date RedHat 9 system (that is, with patches installed
through May 1 2004), it failed at the make check-all step.
The problem was reproducible by going into the tests directory and
make test-Segfault
The last lines of the saved file no-segfault.Rout.fail are
> > ## c.POSIXct :
> >
2004 May 24
1
as.matrix.data.frame() in R 1.9.0 converts to character when it should (?) convert to numeric
Conversion of a data frame to a matrix using as.matrix() when a
column of the data frame is POSIXt and all other columns are numeric
has changed in R 1.9.0 from R 1.8.1. The new behavior issues a
warning message and converts to a character matrix. In R 1.8.1, such
an object was converted to a numeric matrix.
Here is an example.
#### R 1.9.0 ####
> foo <- data.frame(
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
2007 Aug 08
2
Error: Cannot Coerce POSIXt to POSIXct when building package
A newbie here - please forgive me if this is a basic question. We have an
in house package built in R 2.2.1 (yes we're a little behind the times at
our firm)and would like to rebuild it using R 2.5.1. However, when I try
and build the package from source, I keep getting this error:
Error in as(slotVal, slotClass, strict = FALSE) :
no method or default for coercing "POSIXt"
2003 Jun 05
1
question about POSIXct conversion
Hello!
I am trying to compute minimal time on some data like this:
mt<-tapply(mrsh$time1,list(mrsh$var1,mrsh$var2),min):
a b
145 1054800600 1054789800
340 1054804500 1054794600
349 1054820400 1054792800
55 1054800600 1054789200
57 1054814100 1054791000
78 1054822200 1054790400
843
2006 Oct 04
2
integers to POSIXct
What is the recommended way to convert/coerce and integer to a POSIXct
please?
d <- as.POSIXct(Sys.Date())
i <- as.integer(d)
as.POSIXct(i)
Error in as.POSIXct.default(i) : do not know how to convert 'i' to class
"POSIXlt"
This appears to be the behaviour in 2.3.1 and 2.4.0 on windows XP.
I have tried searching on this and found as.Date.integer in package zoo
which
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
2009 May 11
1
inconsistent results for axis.POSIXct
Some time ago, I posted a note about what I considered to be a bug in
axis.POSIXt() for R 2.8.x, relating to whether timezones in the data are
obeyed on the axes. A link to that note, and to a quick and helpful
response, is at the following URL
http://www.nabble.com/patch-for-axis.POSIXct-%28related-to-timezones%29-td22338700.html#a22338700
Note that R 2.9.0 has been adjusted to help with
2006 Jul 23
1
diff, POSIXct, POSIXlt, POSIXt
Dear Listers,
I have encountered a strange problem using diff() and POSIXt:
dts<-c("15/4/2003","15/7/2003","15/10/2003","15/04/2004","15/07/2004","15/10/2004","15/4/2005","15/07/2005","15/10/2005","15/4/2006")
dts <- strptime(dts, "%d/%m/%Y")
class(dts)
[1] "POSIXt"
2006 Jul 23
1
diff, POSIXct, POSIXlt, POSIXt
Dear Listers,
I have encountered a strange problem using diff() and POSIXt:
dts<-c("15/4/2003","15/7/2003","15/10/2003","15/04/2004","15/07/2004","15/10/2004","15/4/2005","15/07/2005","15/10/2005","15/4/2006")
dts <- strptime(dts, "%d/%m/%Y")
class(dts)
[1] "POSIXt"
2012 Mar 30
1
lubridate:ymd_hm and coercion of class POSIXct. Smooth way to restore the date format.
Dear all,
I wish to create a POSIXct variable from date and time variables using the ymd_hm function in package lubridate. In some cases data for time is missing, which causes a problem for ymd_hm. I wish to find a smooth way to handle this.
# Some example data:
x <- data.frame(date = c("2011-09-22", "2011-07-28"), time = c("15:00", NA))
x
# paste date and
2003 Nov 12
3
Chron, as.POSIXct problem
Dear R list,
I noticed the following 'problem' when changing the format of dates
created with seq.dates() (from the Chron library) using as.POSIXct()
(R 1.8.0 on OSX 10.2.8):
> datesTest<-seq.dates(from="10/01/1952", length=3, by="days");
> datesTest
[1] 10/01/52 10/02/52 10/03/52
# Now changing the format to show year as 1952.
>
2011 Mar 08
1
Date arithmetic coerces POSIXlt to POSIXct?
Hi. This feels like a bug to me, or at least an undocumented feature,
but I thought I'd see what people here thought of it. Consider a POSIXlt
object like this one:
> a <- as.POSIXlt ("2011-01-23 12:45:45")
> class (a)
[1] "POSIXlt" "POSIXt"
Fine. Now, if I do some arithmetic on that object, the result is
converted to POSIXct.
> class (a
2006 Oct 12
2
plot.POSIXct
I've never had any issues with the way that plot.POSIXct chooses the
labels of the date axis before, but in this particular case it's output
is a little confusing.
plot(seq(as.POSIXct("1997-10-01"),length.out=108,by="month"),rnorm(108))
This command produces a chart with every x tick mark labeled as "Jan
01".
I can replicate this chart by adding the format
2003 Jan 22
1
Convert numeric value to POSIXct
Hi,
How do I convert a numeric value indicating the time since 1970, back into
a POSIXct class object? I have tried format.POSIXct and as.POSIXct
without success.
For example
> ccc
[1] "1945-01-01 15:00:00 MDT"
> ddd<- as.numeric(ccc);
> ddd
[1] -788842800
> format.POSIXct(ddd)
Error in format.POSIXct(ddd) : wrong class
> as.POSIXct(ddd)
Error in
2012 Aug 24
1
POSIXct-coerced NA's not considered NA by is.na()
Hello folks,
I found a strangeness while experimenting with POSIXct vectors and
lists. It seems that coerced NA's aren't "real" NAs, at least as
considered by is.na()?
> date_vec = c(as.POSIXct(now()), as.POSIXct(now()+1),NA,"b")
> date_vec
[1] "2012-08-22 15:00:46 COT" "2012-08-22 15:00:47 COT" NA
[4] NA
Warning message:
In