> data(Timing)
> use(Timing)
> bed.time<-ISOdatetime(year=2010,month=12,day=13,hour=bedhr,min=bedmin,sec=0)
> bed.day<-ifelse(bedhr>20,12,13)
> bed.time<-ISOdatetime(year=2010,month=12,day=bed.day,hour=bedhr,min=bedmin,sec=0)
> wokeup.time<-ISOdatetime(year=2010,month=12,day=13,hour=wokhr,min=wokmin,sec=0)
> sleep.time<-wokeup.time-bed.time
> sleep.time
Time differences in hours
[1] 3.000000 6.000000 6.333333 4.500000 6.500000 6.583333 5.500000 6.200000 6.500000 7.500000 5.000000 8.000000 5.250000 7.500000 6.250000 1.000000 7.333333 6.250000
attr(,"tzone")
[1] ""
> summ(sleep.time)
obs. mean median s.d. min. max.
18 <NA> numeric 1.7 18 <NA>
结果为什么 有的出不来 为NA,或者numeric,而且那个min好像还错了
我看书上都出的来,都是正确的,为什么???????????
谢谢指教。(sleep.time是一个日期的差值变量,用的是epicalc程序包)
而这样运算
> scan()->aa
1: 3.000000 6.000000 6.333333 4.500000 6.500000 6.583333 5.500000 6.200000 6.500000 7.500000 5.000000 8.000000 5.250000 7.500000 6.250000 1.000000 7.333333 6.250000
19:
Read 18 items
> aa
[1] 3.000000 6.000000 6.333333 4.500000 6.500000 6.583333 5.500000 6.200000 6.500000 7.500000 5.000000 8.000000 5.250000 7.500000 6.250000 1.000000 7.333333 6.250000
> summ(aa)
obs. mean median s.d. min. max.
18 5.844 6.25 1.7 1 8
结果就能出来,为什么