Displaying 20 results from an estimated 10000 matches similar to: "strange date problem - May 3, 1992 is NA"
2011 Mar 10
1
Timezone issue with strftime/strptime and %z and %Z
Hello!
I've been trying to get this right for quite a while now and fear
there is an easy solution I just don't see. I did not have this
problem in Linux, and I searched r-help and Google but did not find a
solution, but of course I am grateful for and resources I might not
have found our not understood yet.
I try to parse a time stamp with time zone. I essentially just want to
parse the
2007 Jan 17
2
problem with unlist POSIX date at midnight
Dear R-users,
I use unlist of POSIX dates to extract the year, hour etc. With that I
can search for files in my database which are in the form
'yyyymmddhh_synops.txt'
However, I get stucked during midnight where unlist just gives NA's.
The script is given below, the problem accurs at acc.period[16]
(midnight). However when I write out the character, unlist works well.
But
2006 Jan 06
1
Daylight Savings Time unknown in R-2.2.1
Under R-2.2.1, a POSIXlt date created with "strptime" has an unknown
Daylight Savings Time flag:
> strptime(20051208, "%Y%m%d")$isdst
[1] -1
This is true on both Linux (details below) and Windows. It did not
occur under R-2.1.0. Any ideas? TIA!
> Sys.getenv("TZ")
TZ
""
Version:
platform = i686-pc-linux-gnu
arch = i686
os = linux-gnu
2004 May 06
3
strptime
Delving into the murky world of dates and times I found this:
dates <- c("02/27/92", "02/27/92", "01/14/92", "02/28/92", "02/01/92")
> times <- c("23:03:20", "22:29:56", "01:03:30", "18:21:03", "16:56:26")
> x <- paste(dates, times)
> z <- strptime(x, "%m/%d/%y
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
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 Jul 19
2
strange problem with strptime and date variable
Hello all,
I am manipulating a large database with 70,000 records. "strptime" generates
a date variable but R treats some of the values as NA. I attach a simple
example below.
I have spent hours on this problem. Any hint would be greatly appreciated.
Many thanks,
Edwin Sun
# =======start of sample code =============
> x <- c("2005-04-02 19:03:00", "2005-04-03
2010 Oct 01
3
Converting a dataframe column from string to datetime
Hi,
I have a dataframe column of the form
v<-c("Fri Feb 05 20:00:01.43000 2010","Fri Feb 05 20:00:02.274000 2010","Fri Feb 05 20:00:02.274000 2010","Fri Feb 05 20:00:06.34000 2010")
I need to convert this to datetime form. I did the following..
lapply(v,function(x){strptime(x, "%a %b %d %H:%M:%OS %Y")})
This gives me a list that looks like
2008 Sep 10
3
(PR#12770) format() under Windows giv wrong resuts with
On Windows XP SP3
> format(pippo, format="%I:%M:%S %p")
[1] "11:43:12 PM"
In any case, if there is a problem it is in Windows, not in R, since this
is an Windows service that is being called. So there is no evidence at
all of any bug in R here.
On Wed, 10 Sep 2008, pego.enrico at tiscali.it wrote:
> Full_Name: Enrico Pegoraro
> Version: 2.7.2
> OS: Windows
2003 Aug 13
1
Problems with addition in big POSIX dates
Have you noticed any problems with big dates (>=1/1/2040) in R?
Here is the bit of code that I'm having trouble with:
> test.date <- strptime("1/1/2040",format="%m/%d/%Y")
>
> unlist(test.date)
sec min hour mday mon year wday yday isdst
0 0 0 1 0 140 0 0 0
>
> date.plus.one <- as.POSIXct(test.date) +
2012 Nov 07
3
extract indep vars from formula
Hello,
I'm trying to extract the independent variables from a formula. The
closest I've been able to come, aside from rolling my own, is the following:
> a = y ~ b * x
> attr(terms(formula(a)),"variables")
The reason I'm doing this is that I'm building a grid of points that I
use to construct a 3-d model prediction surface in rgl. If there are
more than two
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"))
2003 Jan 03
4
as.POSIXct problem?
Under
platform i686-pc-linux-gnu
arch i686
os linux-gnu
system i686, linux-gnu
status
major 1
minor 6.1
year 2002
month 11
day 01
language R
> x <- strptime(c('10/10/1969','12/31/2002'),format='%m/%d/%Y')
2008 Feb 17
1
How to make a vector/list/array of POSIXlt object?
Hi Guys,
I'm cooking up my time series code. I want a data frame with first column as timestamp in POSIXlt format.
I hit on this the problem of how to create an array/list/vector of POSIXlt objects. Code is as follows
> dtt=array(dim = 2)
> t=as.POSIXlt( strptime("07/12/07 13:20:01", "%m/%d/%Y %H:%M:%S",tz="GMT"))
> dtt
[1] NA NA
> t
[1]
2014 Jun 03
3
error de incompatible methods
Hola!!
Estoy intentando ejecutar un script com horas, al principio ejecute estos
comandos
DBx$Date<-strptime(DBx$Date, "%d-%m-%Y") ###Monicap use ; other
use Y
DBx$Year<-as.POSIXlt(DBx$Date)$year+1900
if(filename!="monicap_50.csv") {DBx$Time<-paste(DBx$Time, ":00", sep="")}
Pero me daba el error de que mi base de datos tenia las
2010 Apr 02
1
POSIX primer
I have not used POSIX classes previously and now have a need to use them. I have sports data with times of some athletes after different events. I need to perform some simple analyses using the times. I think I've figured out how to do this. I just want to confirm with others who have more experience that this is indeed the correct approach. If not, please suggest a more appropriate way.
2012 Nov 02
2
backreferences in gregexpr
Hi Folks,
I'm trying to extract just the backreferences from a regex.
> temp = "abcd1234abcd1234"
> regmatches(temp, gregexpr("(?:abcd)(1234)", temp))
[[1]]
[1] "abcd1234" "abcd1234"
What I would like is:
[1] "1234" "1234"
Note: I know I can just match 1234 here, but the actual example is
complicated enough that I have to
2008 Aug 01
1
chron objects: input/output
Hi list, I have some questions regarding
1) conversion of date + time characters to chron
2) formatting chron object printing
Regarding (1), Gabor's Rnews 2004 4/1 article has been indispensible,
but I often work with files where dates and times are contained in a
single field. In this case, I would like to control input/output of
chron objects when each observation of date and time is
2013 Mar 20
3
summarize dataframe based on multiple cols, not their combinations
Hi folks,
I'm trying to figure out how to get summarized data based on multiple
columns. However, instead of giving summaries for every combination of
categorical columns, I want it for each value of each categorical column
regardless of the other columns. I could do this with three different
commands, but i'm wondering if there's a more elegant way that I'm
missing. Thanks!
2008 Mar 05
3
types of vectors / lists
Hello,
I am an advanced user of R. Recently I found out that apparently I do
not fully understand vectors and lists fully
Take this code snippet:
T = c("02.03.2008 12:23", "03.03.2008 05:54")
Times = strptime(T, "%d.%m.%Y %H:%M")
Times # OK
class(Times) # OK
is.list(Times) # sort of understand and not understand that
length(Times)