似乎R可能缺少一个明显的简单功能:psum.它是以不同的名称存在,还是在某个包中?
x = c(1,3,NA,5)
y = c(2,NA,4,1)
min(x,y,na.rm=TRUE) # ok
[1] 1
max(x,y,na.rm=TRUE) # ok
[1] 5
sum(x,y,na.rm=TRUE) # ok
[1] 16
pmin(x,y,na.rm=TRUE) # ok
[1] 1 3 4 1
pmax(x,y,na.rm=TRUE) # ok
[1] 2 3 4 5
psum(x,y,na.rm=TRUE)
[1] 3 3 4 6 # expected result
Error: could not find function "psum" # actual result
Run Code Online (Sandbox Code Playgroud)
我意识到这+已经是psum,但是怎么样NA?
x+y
[1] 3 NA NA 6 # can't supply `na.rm=TRUE` to `+`
Run Code Online (Sandbox Code Playgroud)
有添加的案例psum吗?或者我错过了什么. …
r ×1