similar to: How do I use as.Date when day values are missing?

Displaying 20 results from an estimated 30000 matches similar to: "How do I use as.Date when day values are missing?"

2007 Dec 16
1
Extracting Year (only) information from Non-Standard Dates
I have some data whose date column consists of two types of date entries: (a) year-only entries (eg "1983") and (b) full date info (eg September 12, 1962). Here's what the non-standard date info looks like: > mode(non.standard.dates) [1] "numeric" > head(non.standard.dates) [1] July 15, 1925 February 13, 1923 July 10, 1988 February 24, 1931 [5] 1952
2003 Sep 17
3
Using POSIX?t rather than "chron" or "date"
The problem with POSIXt is that you must consider timezones and daylight vs. standard time issues even if you don't want to. This violates modularity (viz. your routines becomes coupled to unrelated information) and leads to subtle errors where different routines are assuming different time zones. The problem is that the time, date, day of the week, month, etc. of a date depend on its
2009 Jun 04
3
Getting a column of values from a list - think I'm doing it the hard way
Example code it shown below. I think I am doing this the hard way. I'm just trying to get the full year value from an array of dates. An example array is shown below. Right now, I'm using a "for" loop to pull the year out of a list where the dates were split up into their individual components. This seems to work, but just wondering if there is an easier way. Thanks for
2011 May 24
2
Extracting day of month from Date objects
I've always found the chron library to be useful for tasks like this: > x <- round(runif(10)*100000, digits=0) > y <- as.Date(x, origin="1970-01-01") > library(chron) > days(y) [1] 7 25 26 25 10 24 1 31 12 8 31 Levels: 1 < 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < 11 < 12 < 13 < ... < 31 Notice that it returns the days as
2007 Jul 18
3
dates() is a great date function in R
Proper calendar dates in R are great for plotting and calculating. However for the non-wonks among us, they can be very frustrating. I have recently discussed the pains that people in my lab have had with dates in R. Especially the frustration of bringing date data into R from Excel, which we have to do a lot. Please find below a simple analgesic for R date importation that I discovered over
2010 Jun 18
5
extract date time from a text file
I a have a text file where every line is like that: "2007-12-03 13:50:17 Juan Perez" ("yy-mm-dd hh:mm:ss First Name Second Name") I would like to make a data frame with two column one for date and the other one for name. When I use read.delim it was transformed in a data frame with 4 colums. Bye, Sebasti?n.
2010 Dec 10
2
Remove 100 years from a date object
Hello, I have some data that has dates in the form 27.02.37. I convert them to a date object as follows: as.Date(data$date,format="%d.%m.%y") But this gives me years such as 2037 when I would like them to be 1937. I thought of trying to take off some time i.e. as.Date(camCD$DoB,format="%d.%m.%y") - 100*365 But that doesn't seem to work out correctly. Any ideas how to
2004 Aug 17
3
Fwd: strptime() problem?
Hi all; I've already send a similar e-mail to the list and Prof. Brian Ripley answered me but my doubts remain unresolved. Thanks for the clarification, but perhaps I wasn't clear enough in posting my questions. I've got a postgres database which I read into R. The first column is Timestamp with timezone, and my data are already in UTC format. An 'printed' extract of R
2004 Aug 18
1
Fwd: strptime() problem? - Resolved
Hi Gabor and everybody; Thanks Gabor, with the alternative step you've told me the problem is resolved. Comparing the two procedures: Extract from the source 'character' data: > rain$ts[2039:2046] [1] "25/03/2000 22:00:00 UTC" "25/03/2000 23:00:00 UTC" [3] "26/03/2000 00:00:00 UTC" "26/03/2000 01:00:00 UTC" [5] "26/03/2000 02:00:00
2010 Dec 23
5
Writing a single output file
Dear R helpers! Let me first wish all of you "Merry Christmas and Very Happy New year 2011" "Christmas day is a day of Joy and Charity, May God make you rich in both" - Phillips Brooks ## ---------------------------------------------------------------------------------------------------------------------------- I have a process which generates number of outputs. The R code
2005 Sep 18
2
month increment for chron dates
I have a vector of over 7,000 chron dates in the format "mm/dd/yy". I need to increment each date in the vector by a standard number of months. Lapply with seq.dates is working OK; this increments the vector x by 3 months: dates(unlist(lapply(x, function(g) seq.dates(g, by="months", length=4)[4]))) But this takes about 55 seconds to run on a Windows XP 1.8 Pentium 512 RAM PC
2002 Feb 13
2
formatting date strings
Hi all I am a relatively new R user so please excuse this question if it has been covered some where else, just tell me where to find it. I have a simulation model that out puts dates in a standard dd/mm/yy format R reads this as a factor and I cant find anything that will allow me to convert them to a date. In S+ I have used a chron() function that required you to specify the format of the
2004 Mar 01
6
Find out the day of week for a chron object?
I know that this is correct: library(chron) x = dates("01-03-04", format="d-m-y", out.format="day mon year") print(x) It gives me the string "01 Mar 2004" which is correct. I also know that I can say: print(day.of.week(3,1,2004)) in which case he says 1, for today is monday. My question is: How do I combine these two!? :-) I have a
2002 Feb 02
1
chron problem: extracting days and years
Hello r-help, I'm trying to split a character vector of dates of the form "dd-mmm-yy" into component days, months and years. But > library(chron) > testdate<-as.POSIXlt(strptime("17-Sep-98","%d-%b-%y")) > testdate [1] "1998-09-17" > months(testdate) [1] "September" # which is fine, but for days and years I get >
2004 Apr 02
2
How canI convert date-time to Julian date?
Hello!! I need some help! I tried everything, but nothing worked! I have a vector c with dates in it, in the format "2004-04-01" and i need to convert it in the form "04/01/2004" or "01/04/2004" ! How can i do that?? Thanks Bye Martina --
2010 Jun 29
3
formating chron date times for printing
the date were created with chron with this argument format=c(dates="Y/m/d", times="H:M:S")) so I have the dates being displayed as (10/06/22 12:00:00) I would like to have them displayed as "2010-06-22 12:00:00" or "%Y-%m-%d %H:%M:%S" and then I can convert these for mergeing with another data frame x <- (structure(c(14464, 14464.0104166667,
2004 Jun 07
7
Vectors of years, months, and days to dates?
The interface for dates in R is a little confusing to me. I want to create a vector of Date objects from vectors of years, months, and days. One solution I found is: years <- c(1991, 1992) months <- c(1, 10) days <- c(1, 2) dates <- as.Date(ISOdate(years, months, days)) But, in this solution the ISOdate function converts the vectors into characters, which can cause serious
2004 Nov 17
4
summary.lme() vs. anova.lme()
Dear R list: I modelled changes in a variable (mconc) over time (d) for individuals (replicate) given one of three treatments (treatment) using: mconc.lme <- lme(mconc~treatment*poly(d,2), random=~poly(d,2)|replicate, data=my.data) summary(mconc.lme) shows that the linear coefficient of one of the treatments is significantly different to zero, viz. Value Std.Error
2004 Mar 22
1
another date conversion
Dear R People Here is an interesting problem: > library(pastecs) > a <- 1:100 > b <- daystoyears(a,datemin="1/1/2003",dateformat="m/d/Y") > b [1] 2002.999 2003.002 2003.005 2003.008 2003.010 2003.013 2003.016 2003.018 2003.021 2003.024 2003.027 2003.029 2003.032 [14] 2003.035 2003.038 2003.040 2003.043 2003.046 2003.049 2003.051 2003.054 2003.057 2003.060
2005 Aug 02
1
cut.Date functionality for chron date/time objects
Hello, I've encountered the need to cut some chron objects of the form: R> mychron <- chron(sort(runif(10, 0, 10))) R> mychron [1] (01/01/70 16:36:20) (01/02/70 00:08:46) (01/03/70 16:54:49) [4] (01/04/70 06:45:00) (01/07/70 06:21:24) (01/07/70 18:28:44) [7] (01/08/70 00:47:05) (01/08/70 05:11:44) (01/10/70 01:07:53) [10] (01/10/70 17:46:53) into arbitrary (e.g. a given number