similar to: Error as.Date on Invalid Dates

Displaying 20 results from an estimated 3000 matches similar to: "Error as.Date on Invalid Dates"

2005 Feb 24
2
Row median of Date class variables in a data frame
I am trying to calculate the median of each row of a data frame where the data frame consist of columns of class Date. Below are my test data and best attempt at using apply. I didn't see a solution via Google or the Baron search site. I'd be grateful for any suggestions or solutions. I'm using R 2.0.0 on Mac OS X. Thank you, Stephen Weigand ### Test data date1 <- c(1000,
2012 Mar 07
1
date columns chooser
i have a data frame with 2 columns of dates. with str(dataframe) i have ensured myself that they were indeed formatted as dates. one column has NA's in it. the aim is now to make a third column that chooses date1 if it is a date, and choose date2 if it is a NA. i am trying df$date3=ifelse(is.na(df$date1), df$date2, df$date1). this leads to unexpected behaviour: the resulting column is
2005 Oct 04
2
Joining Dataframes
I am attempting to join several dataframes that summarize sampling effort for different samples into one large data.frame/table. I have looked at the merge command, but have not been clever enough to figure out how to get it to do what I want. A simplified example of what I am trying to do: The dataframes I have look like this (they were generated using the table command) species1.effort
2006 Apr 17
1
Function for computing the difference between 2 dates in months
Folks: With the help of David L. Reiner, I've developed a function that computes the number of months between 2 dates, x and y. num.months <- function ( x , y ) { x <- as.Date( x ) y <- as.Date( y ) seeq <- seq(from=x , to=y , by="months") ans <- length( seeq ) - 1 if ( max( seeq) > y ) ans <- ans -1 ans } To ease your reading this function, I've
2012 Jul 06
3
Compare date Oracle with Sys.time
I would like to import only datas of my table where DATE>today-7days. But my datas in Oracle are 'dates' and in R are 'characters'. now_7<-format(Sys.time()-(7*60*60*24), "%Y-%m-%d 00:00:00") How to do? -- View this message in context: http://r.789695.n4.nabble.com/Compare-date-Oracle-with-Sys-time-tp4635624.html Sent from the R help mailing list archive at
2011 Jul 06
3
Reshape from long to wide format with date variable
Hi, I need to reshape my dataframe from a long format to a wide format. Unfortunately, I have a continuous date variable which gives me headaches. Consider the following example: > id=c("034","034","016","016","016","340","340") > date=as.Date(c("1997-09-28", "1997-10-06", "1997-11-04",
2006 Apr 19
0
Function for computing the difference between 2 dates inmonths
not without knowing what dados is. Remember that num.months works only on objects that can be converted to Date objects. Make sure that all of your date-like objects can be converted. (The error message seems to indicate that something you think should look like a date doesn't.) David L. Reiner Rho Trading Securities, LLC Chicago IL 60605 312-362-4963 -----Original Message----- From:
2009 Jul 11
2
Date conversions
Hi all, I'm having a little bit of trouble with some date conversions and am hoping someone can help me out. Thanks in advance. OK, I have two sources of data that provide date info in a csv file differently. I've attached a small zipped file with two text files that illustrate both. (Is it ok to send attachments to this list? Not sure. It's very small.) I need to be able to
2012 Nov 10
4
help on date dataset
Hi everybody, I am beginer in R and I need your precious help. I want to create a small function in R as in sas to retrieve date. I have a file with data that import in R. DATE PAYS nb_pays.ILI. 1 24/04/2009 usa 0 2 24/04/2009 usa 0 3 24/04/2009 Mexique 0 4 24/04/2009
2006 Dec 28
3
Dates in R
Hello all, Can somebody point me to references or provide some code on dealing with this date issue. Basically, I have two vectors of values that represent dates. I want to convert these values into a date format and subtract the differences to show elapsed time in days. More specifically, here is the example: Date1 Date2 032398 061585 032398 061585 111694 101994 111694
2013 Mar 14
3
date & time manipulation- R 2.15.1 windows 7
Hi, I wanted to learn how to solve a date and time manipulation where i can do the following two 1. difference of two dates eg (differnce between 5th jan 2013 and 1st jan 2013) 2.Suppose i have week number of the year, i want to know if i can find out the day it refers to eg( say week 2 of 2013 would be 6th jan 2013 and the day is sunday) i need my result to tell me that its
2004 Oct 11
5
read "4-jan-02" as date
Dear R users, I have a column with dates (character) in a data frame: 12-Jan-01 11-Jan-01 10-Jan-01 9-Jan-01 8-Jan-01 5-Jan-01 and I need to convert them to (Julian) dates so that I can sort the whole data frame by date. I thought it would be very simple, but after checking the documentation and the list I still don't have something that works. 1. as.Date returns the error below. What am I
2015 Nov 06
4
Puzzled by eval
I am currently puzzled by a seach path behavior. I have a library of a dozen routines getlabs(), getssn(), getecg(), ... that interface to local repositories and pull back patient information. All have a the first 6 arguments in common, and immediately call a second routine to do initial processing of these 6. The functions "joe" and "fred" below capture the relevant
2009 Dec 09
1
reshape() makes R run out of memory (PR#14121)
Full_Name: Alexander L. Belikoff Version: 2.8.1 OS: Ubuntu 9.04 (x86_64) Submission from: (NULL) (67.244.71.200) I'm trying to reshape the following data frame: ID DATE1 DATE2 VALUE_TYPE VALUE 'abcd1233' 2009-11-12 2009-12-23 'TYPE1' 123.45 ... VALUE_TYPE is a string and is a factor with only 2 values
2012 May 12
1
Query regarding date as argument in functions - and about sqldf
Hi, I have a query about sqldf, and dates in general. I couldnt find much on the net or on the forums, hence I am here. Here is the issue: I want to write a function that accepts 3 arguments: date1, date2 and a dataframe, say 'df'. Within the function, I want to populate a temp dataframe which essentially contains the output of the query "select * from df where DATE between date1
2008 Apr 11
1
Error in fromchar(as.character(x)) : character string is not in a standard unambiguous format
Hello, I was hoping for advice regarding resolving the above error. I have a csv file that contains the following variable: $ Order.Made.Date : Factor w/ 299 levels "1-Apr-08","1-Aug-05",..: 278 285 91 286 159 132 108 261 282 147 ... I want to calculate a variable named F.length, which is today's date minus the values contained in the variable:
2009 Jan 14
2
List of Lists
Dear All; Is it possible to create a list of lists (I am sure it is) along these lines; I have a dataframe data02 that holds a lot of information, and the first column is ³date² I have a list of dates in; data03<-c(date1,.....,daten) And would like to create a list; data04 <- subset(data02, date == data03[1,]) Ie. data04 holds the data from data02 that matches a date in data03 How do
2013 Mar 09
1
Unexpected behavior looping through sequence of dates
I understand that the two following loops should produce the exact same output. However, they do not. It appears that looping directly through the sequence of Date objects somehow makes them be coerced to numeric: > date1 = "20130301" > date2 = "20130302" > > d1 = as.Date(date1, format="%Y%m%d", tz="GMT") > d2 = as.Date(date2,
2011 Aug 07
1
all.equal doesn't work for POSIXlt objects
Hi all, following sample code illustrates the problem : Date1 <- Date2 <- as.POSIXlt(seq.Date(as.Date("2010-04-01"),as.Date("2011-04-01"),by='day')) identical(Date1,Date2) all.equal(Date1,Date2) identical() gives the correct answer. As there is no all.equal method for POSIXlt objects, all.equal.list is used instead. Subsetting using [[]] doesn't work
2013 Apr 13
2
Comparison of Date format
Hi, ?In the example you provided, it looks like the dates in Date2 happens first.? So, I changed it a bit.? DataA<- read.table(text=" ID,Status,Date1,Date2 ??? ??? ?????? 1,A,3-Feb-01,15-May-01 ??? ??? 1,B,15-May-01,16-May-01 ??? ??? 1,A,16-May-01,3-Sep-01 ??? ??? ??? ??? ??? 1,B,3-Sep-01,13-Sep-01 ??? ??? ??? ??? ??? 1,C,13-Sep-01,26-Feb-04 ??? ??? ??? ??? ???