> ranges1 = tapply(CO2$uptake, CO2[c('Type','Treatment')],range) > ranges1 Treatment Type nonchilled chilled Quebec Numeric,2 Numeric,2 Mississippi Numeric,2 Numeric,2 > str(ranges1) List of 4 $ : num [1:2] 13.6 45.5 $ : num [1:2] 10.6 35.5 $ : num [1:2] 9.3 42.4 $ : num [1:2] 7.7 22.2 - attr(*, "dim")= int [1:2] 2 2 - attr(*, "dimnames")=List of 2 ..$ Type : chr [1:2] "Quebec" "Mississippi" ..$ Treatment: chr [1:2] "nonchilled" "chilled"
> x <- c(1,2,3) > x[0] numeric(0) > x[c(0,2)] [1] 2エラーにはならないらしい.無視するということか.
x[c(-1,2)] 以下にエラー x[c(-1, 2)] : 負の添字と混在できるのは 0 という添字だけです