search for: ymd

Displaying 20 results from an estimated 59 matches for "ymd".

Did you mean: cmd
2004 Jun 14
4
Quirks with system.time and simulations
I tried the code that Richard O'Keefe posted last week, to wit: library(chron) ymd.to.POSIXlt <- function (y, m, d) as.POSIXlt(chron(julian(y=y, x=m, d=d))) n <- 100000 y <- sample(1970:2004, n, replace=TRUE) m <- sample(1:12, n, replace=TRUE) d <- sample(1:28, n, replace=TRUE) system.time(ymd.to.POSIXlt(y, m, d)) [1] 8.78...
2006 Jun 15
1
Problem with Julian function
...uot;,"2000-05-19","2000-05-19" > ,"2000-05-19", "2000-05-19", "2000-05-20", "2000-05-20", "2000-05-20") I load the date and chron libraries, I define the vector of character as a date variable using the dates function: > ymd <- dates(amj,format=c(dates="y-m-d"),origin=c(month=1, day=1,year=2000)) Then when I apply the Julian function: > julian(months(ymd),days(ymd),years(ymd),origin=c(month = 1, day = 1, year = as.numeric(years(ymd[1])))) I get the following result: [1] 137 137 137 138 138 138 138 1...
2007 Mar 12
1
timeDate & business day
I have a daily time series and have two questions to get some help with. Firs,t I have dates in simple numeric values. e.g. ymd [1] 20050104 20050105 20050106 20050107 20050110 20050111 20050113 20050114 [9] 20050118 20050120 20050121 20050124 20050125 20050126 20050127 20050128 [17] 20050201 20050202 20050203 20050204 Now, I'd like to compute statistics, e.g. acf, by business days. So, I try to convert it into timeDat...
2004 Feb 23
6
Need help on parsing dates
I know this: > library(date) > x="1979-04-04" > try=as.date(x, "ymd") > print(try) [1] 4Apr79 and that `x' here has to be a string, e.g.: > x=1979-04-04 > print(x) [1] 1971 I'm stuck in reading from a file. I say: > A <- read.table(file="try") > print(A) V1 V2 1 1979-04-04 -1.0471...
2006 Nov 16
6
Gantt chart problem after upgrade to R 2.4.0
...deau/R/gantproblem.pdf for the two charts. The charts were produced today using the same version of plotrix (installed on both versions of R today) System : Windows XP I am pretty new to R and especially to plotrix and I don't see what I am doing wrong. I have tried to play around with the Ymd.format with no luck Have I missed something in the upgrade notes? Can anyone suggest something? Thanks My code is: require(plotrix) Ymd.format <- "%Y/%m/%d" Ymd <- function(x){ as.POSIXct(strptime(x, format=Ymd.format))} gantt.info <- list( labels =c("Dickens&qu...
2009 Aug 21
2
gantt chart for dataset
hi, Thanks for responding of gantt charts. but i have some problem regarding with gantt charts. i.e. Ymd.format <- "%Y/%m/%d" Ymd <- function(x){ as.POSIXct(strptime(x, format=Ymd.format))} gantt.info <- list( labels =c("First task","Second task","Third task","Fourth task","Fifth task"), starts =Ymd(c("2004/01/0...
2010 Feb 27
1
help with Gantt chart
Hi, I don't know to solve this error that is returned, even though I understand it: library(plotrix) Ymd.format<-"%Y/%m/%d" gantt.info<-list(labels= c("First task","Second task (1st part)","Third task (1st part)","Second task (2nd part)","Third task (2nd part)", "Fourt task","Fifth task","Sixth task"),...
2014 Jul 17
3
FW: Selección eficiente de individuos
...ntervalo se solapa del paquete "lubridate": #---------------------- library(lubridate) fe.chas <- data.frame( entra=c('2001-01-01','2001-06-01','2003-01-01') ,sale=c('2002-01-01','2002-06-01','2004-01-01') ) ref <- new_interval(ymd('2001-12-01'), ymd('2002-01-01')) mapply( function(x,y,z) {int_overlaps(new_interval(x,y),z)} ,fe.chas$entra, fe.chas$sale, ref ) #--------------------- ​Produce este resultado: > fe.chas <- data.frame( + entra=c('2001-01-01','2001-06-01...
2024 Nov 09
3
Limit
Hi All, I am reading data file ( > 1B rows) and do some date formatting like dat=fread(mydatafile) dat$date1 <- as.Date(ymd(dat$date1)) However, I am getting an error message saying that Error: cons memory exhausted (limit reached?) The script was working when the number rows were around 650M. Is there another way to handle a big data set in R? Thank you.
2012 Jun 08
3
day of the year for chron objects
...etrieve the day of the year (since 1st Jan of the same year)? I know I can make my own using julian, but find it weird that having days(), months() etc doy() does not exist as an standard function. Also, is the following not a bit inconsistent? > a <- chron("20100506",format="ymd") > a [1] 100506 > years(a) [1] 2010 Levels: 2010 but instead have to cast to Date to apply julian: > julian(a) Error in names(d) : 'd' is missing > julian(as.Date(a)) [1] 14735 attr(,"origin") [1] "1970-01-01" Thanks Agus -- -- Dr. Agustin Lobo Ins...
2004 May 27
3
Date parsing question
How do I parse a date "yyyymmdd"? I tried asking chron(s, "ymd") but that didn't work. Would the date parsing routines of the Date class of 1.9 grok this? -- Ajay Shah Consultant ajayshah at mayin.org Department of Economic Affairs http://www.mayin.org/ajayshah Ministry...
2010 Dec 08
1
possible bug in chron packages
Dear, According to the documentation, the parameters given in "dates" are passed to the function "chron". When trying this out, it turns out that this apparently doesn't happen, eg: > dates("20100101",format="Ymd",out.format="day mon year") [1] 01/01/10 > chron("20100101",format="Ymd",out.format="day mon year") [1] 01 Jan 2010 I would expect the outcome of both functions to be the same, or am I overlooking something? Kind regards Joris -- Joris Meys Statis...
2013 Dec 09
1
Plot mortality data and show trend
I have a mortality data over many years and I wish to plot the data and also add some smoother to clearly highlight the trend. How could I do that in R with base graphics or ggplot? I have the following sample data: require(lubridate) mdate<-seq(ymd('2000-01-01'),ymd('2010-12-31'), by = '1 day') death<- rnorm(4018, 80, 45) df<-cbind(mdate,death) [[alternative HTML version deleted]]
2017 Feb 16
6
Ayuda con Date
Hola. Tengo una duda con esta sintaxis. Tengo una variable con formato Date que por algún motivo (el data.table viene de una consulta con PostgreSQL): datos <- prov[, pprid, pprfecbaja] str(datos) Cuando intento quitar las fechas de bajas inválidas (0001-01-01) y convertirlas a NA, la variable resultante "pierde" su condición de Date. Probé con distintas formas, siempre con el mismo
2010 Dec 03
1
intraday zoo
...> head(dat) TrdDate TrdTime impliedVol 1 20090102 09:55:03 0.3610715 2 20090102 09:55:04 0.3637943 3 20090102 09:55:05 0.3752375 4 20090102 09:55:05 0.4190025 5 20090102 09:55:06 0.3696080 6 20090102 09:55:06 0.4944981 > f <- function(x) chron(x[,1],x[,2], format=c(dates="ymd", times="h:m:s")) > head(z) (741031 09:55:03) (741031 09:55:04) (741031 09:55:05) (741031 09:55:05) (741031 09:55:06) (741031 09:55:06) 0.3610715 0.3637943 0.3752375 0.4190025 0.3696080 0.4944981 Warning message: In zoo(rval[i], x.index[i])...
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
2018 Oct 22
2
Agregar variable entre dos fechas
Buenas, Tengo un dataframe con 64.000 observaciones llamado Datos y las variables "Id.Producto","Fecha"y "Rating" . La variable fecha tiene el formato: 2016-12-28 (ymd). Quiero crear la variable: "Rating.Semanal" - Esta variable tiene que ser la media agregada por "Id.Producto" de la variable "Rating", solo teniendo en cuenta aquellas observaciones que estén entre el "2016-12-21" y "2016-12-28". Muchas gracias...
2010 Jul 28
2
wget and resulting filenames with mirror option
I am trying to mirror a directory using wget and the resulting files as expected are taking the name of the string in the url after the last "/". Anyone know a way around this? I am using the mirror option so I don't have to keep track of what to get making it simple. Thanks! jlc
2011 Sep 12
5
Hourly data with zoo
...seq(from = 0, to = 2300, by = 100) df <- data.frame(LST_DATE = d, LST_TIME = h, data = rnorm(24, 0, 1)) S <- chron(dates. = as.character(df$LST_DATE), times. = paste(as.character(df$LST_TIME/100), ":0:0", sep = ""), format = c(dates = "Ymd", times = "h:m:s")) X <- zoo(df$data, order.by = S) And I want to create a regular zoo series, The above works but its pretty ugly. Is there a more elegant way to do this.
2012 Nov 16
2
lubridate concatenation issue
...#39;s lubridate which seems a very neat package, but i am having a small problem with  concatenating lubridates to build vectors of it. Namely when function c( )  is applied to lubridate seems to change time to a local timezone in this particular case changing the date to previous one.  > d<-ymd('20111231') > d [1] "2011-12-31 UTC" > c(d) [1] "2011-12-30 19:00:00 EST" Is this the expected behavior and if yes, how could it be avoided for this function and the others that possibly do the same? I mean, i could create the date in my local timezone and avoid...