search for: firstdate

Displaying 3 results from an estimated 3 matches for "firstdate".

2001 Feb 13
0
handle date variables
...2. How to convert a string into a date value. For example, convert 20010122 to 2001 Jan 22, and get its day of the week, i.e. Monday? 3. How to handle date variables in a loop? How to make the following codes work? And how users should pass the date arguments to the function? fun1 <- function(firstdate, lastdate) { for ( i in firstdate:lastdate) { do something.... } } fun1(2001/01/22, 2001/01/27) --- Douglas Bates <bates at stat.wisc.edu> wrote: > Yu-Ling Wu <yuling5 at yahoo.com> writes: > > > I'd like to pass a string to a function as the &gt...
2011 Feb 09
1
Iterate over a list of input files?
...in the directory tested and augment the data frame I'm building to have more results columns.How can I do that? Here's the code: library(chron) # .Holidays / is.holiday / is.weekend TStoDate = function (TSDate) { X = strptime(TSDate + 19e6L, "%Y%m%d") return(as.Date(X)) } FirstDate = 1090601 LastDate = 1101101 StartDate = TStoDate(FirstDate) EndDate = TStoDate(LastDate) # Create a sequence of days from start to finish # Then remove weekends and holidays and turn into a data.frame dd <- seq(StartDate, EndDate, by = "day") TradingDate <- dd[!is.weekend(dd) &a...
2013 Feb 11
2
Inserting rows of interpolated data
Dear help list - I have light data with 5-min time-stamps. I would like to insert four 1-min time-stamps between each row and interpolate the light data on each new row. To do this I have come up with the following code: lightdata <- read.table("Test_light_data.csv", header = TRUE, sep = ",") # read data file into object "lightdata" library(chron) mins <-