Displaying 20 results from an estimated 6000 matches similar to: "value of strptime in R 1.8.0"
2003 Nov 14
5
ISOdate() and strptime()
Dear R-people!
I am using R 1.8.0, under Windows XP.
While using ISOdate() and strptime(), I noticed the following behaviour when
"wrong" arguments (e.g., months>12) are given to these functions:
> ISOdate(year=2003,month=2,day=20) #ok
[1] "2003-02-20 13:00:00 Westeurop?ische Normalzeit"
> ISOdate(year=2003,month=2,day=30) #wrong day, but returns a value
[1]
2003 May 14
2
number of patients in a hospital on a given date
Dear R-users!
I am using R 1.7.0, under Windows XP.
Having some hospital discharge data (admission date and discharge date for
each patient), I want to get the number of patients in the hospital on a
given date.
My data look like (simple example):
> x <- data.frame(patid=c("pat1", "pat2"), adm.date = c("15.03.2002",
"16.03.2002"),
2003 Nov 25
0
AW: ISOdate() and strptime()
Thanks for this clarification.
I have learned in the meantime that it is necessary to be very careful when
using all these POSIX things.
As another example, here is something that made me scratch my head just
yesterday:
When I create a sequence of days that happens to start before and ends in
daylight savings time, I seem to lose a day:
> seq(from = strptime("20030329",
2003 Jul 09
2
RODBC and Oracle: error "table does not exist"
Dear r-helpers!
I have trouble reading data from an Oracle data base using
RODBC Version 1.0-3,
R Version 1.7.1,
Windows XP,
Oracle8 ODBC Driver Version 8.1.6.4.0:
> library(RODBC)
> channel <- odbcConnect(dsn="PAV32", case="oracle", believeNRows=FALSE)
> # ok, this was succesful
> x <- sqlTables(channel)
> x[37, ]
TABLE_CAT TABLE_SCHEM TABLE_NAME
2009 Apr 13
1
value of strptime in R 1.8.0
Dear R friends,
I have a data frame, I need to get a time interval between the two columns.
The times are recorded in 24 hour clock. My data frame is called
version.one.
my commands are:
t.s.one<-paste(version.one[,9])
t.s.two<-paste(version.one[,61])
x<-strptime(t.s.one,format="%H:%M")
x
y<-strptime(t.s.two ,format="%H:%M")
y
z<-difftime(y,x, units =
2002 Jun 12
2
data mining: finding association rules
Dear R-users!
I would like to search for "association rules" (and compute support and
confidence, for example) in a data set, and wonder if this can be done with
R (version 1.5.0 for Windows)?
Particulary, I wonder if
a) anyone has done something like that with R
or
b)maybe someone has written an R-interface to some existing
algorithm/software (e.g. to something like the
2003 Aug 27
4
read.spss (package foreign) and character columns
Dear R users!
I am using R Version 1.7.1, Windows XP, package "foreign" (Version: 0.6-1),
SPSS 11.5.1.
There is one thing I noticed with "read.spss", and I'd like to ask if this
is considered to be a feature, or possibly a bug:
When reading character columns, character strings seem to get filled with
blanks at the end.
Simple example:
In SPSS, create a file with one
2009 Sep 02
4
within: order of newly added variables
Dear R community,
I am using function 'within' in R.2.9.1 to add variables to an existing data.frame. This works wonderful, except for one minor point: The new variables are added to the data in reverse order.
For example:
x <- data.frame(a = 1:3, b = 4:6)
y <- within(x, {
c = a^2
d = b^2
e = c+d
}
)
gives
a b e d c
1 1 4 17 16 1
2 2 5 29 25 4
3 3 6 45 36 9
2010 Oct 28
2
replace text at certain positions in a file
Hello,
I am working with R version 2.10.1 under windows.
In a text file, I need to replace all characters at certain column positions with blanks.
For example, say the file contains two lines and looks like this:
ab34cd78e
fg3 hi78j
I'd like to replace everything at positions 3-4 and 7-8 with blanks, so the output should be:
ab cd e
fg hi j
[I'm not sure if this is really an R
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
2010 Jan 26
2
tapply and more than one function, with different arguments
Dear R-users,
I am working with R version 2.10.1.
Say I have is a simple function like this:
> my.fun <- function(x, mult) mult*sum(x)
Now, I want to apply this function along with some other (say 'max') to a simple data.frame, like:
> dat <- data.frame(x = 1:4, grp = c("a","a","b","b"))
Ideally, the result would look something like
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
2011 Jun 17
1
issue with strptime
Hi everyone,
I have bunch of date and time observations in the format %Y-%m-%d %I %M %S
%p. I used strptime() to read this format. But the problem is some of the
times are in the format of %I %M %p, so for those times, strptime is giving
me NA values.
For example,
strptime(paste("2009-04-08","1:49:47 PM"),format="%Y-%m-%d %I:%M:%S %p")
[1] "2009-04-08
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
> |
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