Displaying 20 results from an estimated 20000 matches similar to: "issue with strptime"
2010 Nov 14
2
replace a row in a matrix
Dear all,
I created a n*2 matrix and I want to replace the ith row with a vector. Can
anyone suggest me what is the simple way to do it? Sorry for bothering you
with such simple question. I appreciate any hints or advice.
Thanks in advance.
Cassie
[[alternative HTML version deleted]]
2010 Nov 09
2
simulation from pareto distn
Dear all,
I am trying to simulate from truncated Pareto distribution. I know there is
a package called PtProcess for Pareto distribution...but it is not for
truncated one. Can anyone please help me with this?
Thanks in advance.
Cassie
[[alternative HTML version deleted]]
2011 Apr 08
4
Simulation from discrete uniform
Dear all,
I am trying to simulate from discrete uniform distribution. But I could not
find any in-built code in R. Could anyone help me please?
Thanks in advance for the time and help.
Cassie
[[alternative HTML version deleted]]
2011 Jun 22
2
strange date problem - May 3, 1992 is NA
> is.na(strptime("5/2/1992", format="%m/%d/%Y"))
[1] FALSE
> is.na(strptime("5/3/1992", format="%m/%d/%Y"))
[1] TRUE
Any idea what's going on with this? Running strptime against all dates
from around 1946, only 5/3/1992 was converted as "NA". Even stranger,
it still seems to have a value associated with it (even though is.na
thinks
2012 Apr 10
1
how to convert seconds to 12 hour time format
Hello everyone,
I am wondering if there is any routine in R which can convert time given in
'seconds' unit to the 12 hour time format. For example, suppose the data
set looks like
x=c(36885,84000,20) #x in seconds
I want to get the output as
[1] " 11:14:45 AM"
[2] " 11:20:00 PM"
[3] "12:20:00 AM"
Does anyone have any idea? Thanks in advance.
Cassie
2017 Jan 11
2
bug with strptime, %OS, and "."
On Tue, Jan 10, 2017 at 08:13:21PM -0600, Dirk Eddelbuettel wrote:
>
> On 10 January 2017 at 17:48, frederik at ofb.net wrote:
> | Hi R Devel,
> |
> | I just ran into a corner case with 'strptime'. Recall that the "%OS"
> | conversion accepts fractional seconds:
> |
> | > strptime("17_35_14.01234.mp3","%H_%M_%OS.mp3")$sec
> |
2017 Jan 11
4
bug with strptime, %OS, and "."
Hi R Devel,
I just ran into a corner case with 'strptime'. Recall that the "%OS"
conversion accepts fractional seconds:
> strptime("17_35_14.01234.mp3","%H_%M_%OS.mp3")$sec
[1] 14.01234
Unfortunately for my application it seems to be "greedy", in that it
tries to parse a decimal point which might belong to the rest of the
format:
>
2008 May 30
3
Strptime
Hi
This code should explain what I'm trying to do
> strptime("30-Jan-08", "%d-%b-%y")
[1] "2008-01-30"
>
> format(strptime("30-Jan-08", "%d-%b-%y") , "%b-%y")
[1] "Jan-08"
>
> strptime(format(strptime("30-Jan-08", "%d-%b-%y") , "%b-%y") ,
"%b-%y")
[1] NA
I have a
2007 Jan 08
1
Does strptime(...,tz="GMT") do anything?
Hi All
In trying to correlate some tide gauge data I need to deal with varying
timezones. From the documentation on strptime, it seemed that the tz
variable might have some effect on the conversion, but I'm not seeing an
effect.
> strptime("20061201 1:02 PST",format="%Y%m%d %H:%M",tz="PST")+0
[1] "2006-12-01 01:02:00 EST"
>
2007 Jun 12
1
Can strptime handle milliseconds or AM/PM?
I'm trying to proess date/time fields from files that were given to me to
analyze.
Any clues what I'm doing wrong with strptime? This seems to fail the same
way under Linux or Windows.
For ?strptime would it make sense to explain %OS3 somewhere besides the
Examples?
> # Why does %OS3 work here?
> format(Sys.time(), "%H:%M:%S")
[1] "16:45:19"
>
2011 Jul 06
1
trouble parsing a date using strptime()
Hi,
I am having a trouble parsing dates using strptime() that I get in the
format of year and week number. The data looks like this "201127" which
means year 2011 and week 27. I would like to graph this using ggplot but
then I get a gap between 201054 and 201101 so I thought I would just easily
convert it.
I tried to use strptime and as.Date and the format string of %Y%W but it
seems
2017 Jan 17
1
strptime("1","%m") returns NA
Hi Frederik,
On Mon, 2017-01-16 at 18:20 -0800, frederik at ofb.net wrote:
> Hi R Devel,
>
> I wrote some code which depends on 'strptime' being able to parse an
> incomplete date, like this:
>
> >
> > base::strptime("2016","%Y")
> [1] "2016-01-14 PST"
>
> The above works - although it's odd that it gives the month
2009 Oct 26
3
as.POSIXct month problem
Hi everybody
When I try example of strptime
x <- c("1jan1960", "2jan1960", "31mar1960", "30jul1960")
z <- strptime(x, "%d%b%Y")
The result is;
> z
[1] NA NA NA NA
I have got the same result with complete form of month but not with numeric
form.
Any idea?
[[alternative HTML version deleted]]
2006 Apr 15
1
strptime failure R 2.2.1 (PR#8773)
Full_Name: Bill Hutchison
Version: 2.2.1
OS: Windows XP
Submission from: (NULL) (69.158.121.13)
example(strptime) produces the following error:
Error in strptime(x, "%d%b%Y") : 2 arguments passed to 'strptime' which requires
3
This error occurs wherever strptime is used. It does not occur in 2.2.0
2011 Feb 08
3
strptime "March 14 2010" and NA?
Converting date strings that range between Mar-14-2010 2:00 and
Mar-14-2010 2:59 (inclusive) to date objects (POSIX) returns a NA entity:
> strptime("3/14/2010 2:00",format="%m/%d/%Y %H:%M")
[1] "2010-03-14 02:00:00"
This looks fine, however other functions such as plot see a NA object
instead:
> is.na(strptime("3/14/2010
2002 Apr 08
1
Problem(?) in strptime()
I think the following examples illustrate the crux of the matter
(version and OS info are below).
The problem has to do with the transition from standard time to
daylight savings time. My timezone, US/Pacific, has two parts:
standard time (PST) 8 hours behind GMT and daylight savings time
(PDT) 7 hours behind GMT. The transition takes place this year on 7
April at 02:00, when 02:00 is
2012 Jul 10
1
Negative years with strptime?
Is there a way to make as.Date() and strptime() process strings with
negative years? It appears that Date objects can contain negative years and
you can convert them to strings, but you can't convert them back to Date
objects.
x <- as.Date(c("0001-01-24", "0500-01-24"))
as.character(x)
# "0001-01-24" "0500-02-02"
as.Date(as.character(x))
#
2006 Mar 07
3
Applying strptime() to a data set or array
I'm sure this is just the result of a basic misunderstanding of the
syntax of R, but I am stumped.
A <-
read.table(file="sumByThirtyMinute.csv",sep=",",col.names=c("date","pandl"))
A now consists of thousands of rows, but A$date is a string...
...
3183 2006-02-28 12:00:00 548.470
3184 2006-02-28 12:30:00 515.240
3185 2006-02-28 13:00:00
2020 Nov 01
0
strptime() keeps emitting warnings after establishing a handler with tryCatch()
Hello,
I cannot reproduce this behavior and, as documented, the posted code
doesn't issue warnings due to a wrong timezone but I'm running
sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.1 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK:
2003 Nov 12
1
value of strptime in R 1.8.0
Dear R-people!
I am using R 1.8.0, under Windows XP.
What I want to do is a date conversion of a character column of a data frame
and assign the result as a new column.
Simple example:
> x <- data.frame(a=c("yesterday","today","tomorrow"), b=I(c("20031111",
"20031112", "20031113")))
# convert x$b from character to date:
>