【发布时间】:2021-06-29 17:38:08
【问题描述】:
我想创建if() 条件来捕获list() 的x 元素中的值与@987654325 的y 元素中的值不完全相同的OR 值@ 不完全相同或两种情况一起出现。
为了具体起见,我提供了 4 个列表以及下面的预期警告。
这在 R 中可能吗?
A = list(x = c(1,1,1,1), y = c(2,4,3,3)) # Expect warning that says `y` is bad!
B = list(x = c(1,2,1,1), y = c(3,3,3,3)) # Expect warning that says `x` is bad!
C = list(x = c(1,2,1,1), y = c(3,2,3,3)) # Expect warning that says `x` and `y` are bad!
D = list(x = c(1,1,1,1), y = c(3,3,3,3)) # Expect no warning !
【问题讨论】:
标签: r list function dataframe error-handling