[R] cut - strange NA as output

William Dunlap wdunlap at tibco.com
Tue Oct 6 21:54:56 CEST 2015


Because
  > tail(seq(0, max(x), by=1))
  [1] 1350 1351 1352 1353 1354 1355
  > tail(seq(0, ceiling(max(x)), by=1))
  [1] 1351 1352 1353 1354 1355 1356
and max(x)=1355.88836502166 is beyond the range
of the former.

Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Tue, Oct 6, 2015 at 12:20 PM, Hermann Norpois <hnorpois at gmail.com> wrote:
> Hello,
>
> why do I get NA for the following:
>
> cut (x, seq (0, max(x), by=1), label=FALSE)
>  [1] 1322 1175 1155 1149 1295 1173 1289 1197   NA 1129
>
> dput (x)
> c(1321.55376901374, 1174.35657200935, 1154.02042504008, 1148.60981925942,
> 1294.6166388941, 1172.45806806869, 1288.31933914639, 1196.26080041462,
> 1355.88836502166, 1128.09901883228)
>
> Thanks
> Hermann
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list