Skip to content

Can you help me please

1 message · arun

#
HI Fares,

Sorry, that I misunderstand your question.
Probably, this works for you.
date1<- seq.Date(as.Date("1jan2003",format="%d%b%Y"),as.Date("1jan2013",format="%d%b%Y"),by="day")
?? length(date1)
#[1] 3654
?set.seed(51)
?donation<-sample(1000:3000000,3654,replace=FALSE)
?dat1<-data.frame(date1,donation)
?library(chron)
nrow(dat1[is.weekend(dat1[,1]),])
#[1] 1044
set.seed(15)
?dat1[,2][is.weekend(dat1[,1])]<-sample(1:500,1044,replace=TRUE)
?head(dat1)
#?????? date1 donation
#1 2003-01-01? 2328151
#2 2003-01-02?? 602210
#3 2003-01-03?? 895550
#4 2003-01-04????? 302
#5 2003-01-05?????? 98
#6 2003-01-06? 2503433
?nrow(dat1)
#[1] 3654
?str(dat1)
#'data.frame':??? 3654 obs. of? 2 variables:
# $ date1?? : Date, format: "2003-01-01" "2003-01-02" ...
# $ donation: int? 2328151 602210 895550 302 98 2503433 2254394 1218622 2913082 337881 ...



A.K.




----- Original Message -----
From: Fares Said <frespider at hotmail.com>
To: arun <smartpink111 at yahoo.com>
Cc: 
Sent: Friday, January 4, 2013 1:38 PM
Subject: Re: Can you help me please

Sorry Arun, 

I don't have any columns I need to generate them both with certain criteria.? First column is the date from jan2003 until jan2013. And the second columns is number of donations. But make sure that the number is greater than 1000 for weekdays and less than 500 for weekends. And after you create the date column I would like to know how I can format that column. 

I hope this is clear now and thank u so much. 

Fares

Sent from my iPhone
On 2013-01-04, at 13:26, "arun" <smartpink111 at yahoo.com> wrote: