Re: [R] Count observation based on hour

2014-02-08 Thread arun
Hi, Try: #using the same `data`  res1 <- as.data.frame(table(with(dat,cut(Date,breaks=seq(as.POSIXct("2013-01-01 00:00:00"),max(Date)+3600,by='1 hour') A.K. Hi A.K. Thank you very much! It worked!!  Just another quick follow-up question: res <- as.data.frame(table( with(dat,cut(Dat

Re: [R] Count observation based on hour

2014-02-06 Thread arun
HI Map, I am not sure what you really wanted.  Perhaps, this helps: dat <- structure(list(Date = c("2014-01-01 00:00:00", "2014-01-02 11:00:00", "2014-01-02 22:00:00", "2014-01-03 03:00:00", "2014-01-01 00:00:00", "2014-02-02 11:00:00", "2014-02-02 22:00:00", "2014-02-03 03:00:00", "2014-02-01

Re: [R] Count observation based on hour

2014-02-05 Thread arun
Hi, Try: data.frame(table(dat$Date)) A.K. Hi guys, I have some 20,000 observations like this:           Date       2014-01-01 00:00:00 2014-01-02 11:00:00 2014-01-02 22:00:00 2014-01-03 03:00:00 I want to perform an hourly count (e.g. the frequency occur at each hour for a specific date)

Re: [R] Count observation

2009-06-11 Thread Henrique Dallazuanna
Try this also: cbind(data, tabulate(boot, nbins=nrow(data))) On Thu, Jun 11, 2009 at 4:13 PM, MarcioRibeiro wrote: > > Hi listers, > I have the following code... > > data<-as.matrix(c(1,2,3,4,5,6,7,8,9,10),nrow=10,ncol=1,byrow=TRUE) > n<-nrow(data) > m<-n-1 > boot<-data[sample(m,replace=T),] >

Re: [R] Count observation

2009-06-11 Thread MarcioRibeiro
Hey... Milton... Is that a equation... Brazil=Toronto If so, mine is... Brazil=Montreal You got it... I am not having a good time with R... There is no help for data manipulation at all... Thanks for the help... Marcio milton ruser wrote: > > Hi Marcio, > > data.frame(table(boot)) > ? > > m

Re: [R] Count observation

2009-06-11 Thread Jorge Ivan Velez
Dear Marcio, Here is one way. Please notice that even thought I changed the name of your data as well as its structure, you can easily modify it to your needs. # Data somedata <- 1:10 n<-length(somedata) m<-n-1 # 1 sample boot <- somedata[ sample(m,replace=T) ] table(factor( boot, levels=1:10 ) )

Re: [R] Count observation

2009-06-11 Thread milton ruser
Hi Marcio, data.frame(table(boot)) ? milton brazil=toronto On Thu, Jun 11, 2009 at 3:13 PM, MarcioRibeiro wrote: > > Hi listers, > I have the following code... > > data<-as.matrix(c(1,2,3,4,5,6,7,8,9,10),nrow=10,ncol=1,byrow=TRUE) > n<-nrow(data) > m<-n-1 > boot<-data[sample(m,replace=T),] > >

[R] Count observation

2009-06-11 Thread MarcioRibeiro
Hi listers, I have the following code... data<-as.matrix(c(1,2,3,4,5,6,7,8,9,10),nrow=10,ncol=1,byrow=TRUE) n<-nrow(data) m<-n-1 boot<-data[sample(m,replace=T),] So, I need to count the number of times each observation was selected at the sample with replacement... Suppose I sampled... 4 5 1 3 7