Is there a vectorized parallel max() and min()?

后端 未结 4 1538
滥情空心
滥情空心 2020-12-01 11:49

I have a data.frame with columns \"a\" and \"b\". I want to add columns called \"high\" and \"low\" that contain the highest and the lowest among columns a and

4条回答
  •  日久生厌
    2020-12-01 12:40

    If your data.frame name is dat.

    dat$pmin <- do.call(pmin,dat[c("a","b")])
    dat$pmax <- do.call(pmax,dat[c("a","b")])
    

提交回复
热议问题