[R] ggplot barchart: bars don't stock on breaks

2015-01-12 Thread najuzz
Hi guys, I have the following weired problem. I just want a simple barchart, but the visuals are different from what I expect. xx<-as.vector(xx) xx[1:4852]<-0 xx[4853:5941]<-1 table(xx) x<-data.frame(xx) ggplot(x,aes(xx))+geom_bar(binwidth = 0.5)

[R] number of individuals where X=0 during all periods (longitudinal data)

2014-12-22 Thread najuzz
#Hi guys, #I would like to count the number of individuals that receive X=0 troughout their observational period. #example dataset: ID<-c(1,1,1,1,2,2,3,3,3) X<-c(0,1,2,1,0,0,0,0,0) Time<-c(1,2,3,4,1,2,1,2,3) Test<-data.frame(ID,X,Time) # Individuals 2 and 3 have x=0 during all their periods. Th