tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf Of Rui Barradas
> Sent: Thursday, July 19, 2012 1:11 AM
> To: Robert Latest
> Cc: r-help@r-project.org
> Subject: Re: [R] Finding the last value b
---- Original-Nachricht ----
> Datum: Thu, 19 Jul 2012 09:42:05 +0200
> Von: Robert Latest
> An: > Betreff: [R] Finding the last value before a certain date
> Hello all,
>
> I have a dataframe that looks like this:
>
> head(df)
> datey
> 1
Hi Robert,
how about this (assuming your data.frame is ordered by date):
tmp<-read.table(textConnection("datey
1 2010-09-27 1356
2 2010-10-04 1968
3 2010-10-11 2602
4 2010-10-17 3116
5 2010-10-24 3496
6 2010-10-31 3958"),header=T,colClasses=c(date="Date"))
tmp[max(which(tmp$date Hello
Hello,
Try the following.
dat <- read.table(text="
datey
1 2010-09-27 1356
2 2010-10-04 1968
3 2010-10-11 2602
4 2010-10-17 3116
5 2010-10-24 3496
6 2010-10-31 3958
", header=TRUE, stringsAsFactors=FALSE)
dat$date <- as.Date(dat$date)
str(dat)
search <- as.Date("2010-10-06")
max(wh
Hello all,
I have a dataframe that looks like this:
head(df)
datey
1 2010-09-27 1356
2 2010-10-04 1968
3 2010-10-11 2602
4 2010-10-17 3116
5 2010-10-24 3496
6 2010-10-31 3958
I need a function that, given any date, returns the y value
corresponding to the given date or the last day b
5 matches
Mail list logo