r - Issue in Not operator
问题描述
Can anyone please help me. Not sure what wrong I am doing here. As per the code I should get the result as "A" right? Or Am i missing something?
> asd <- c("A")
> asd1 <- c("B","V")
> asd[asd %in% !(asd %in% asd1)]
character(0)
解决方案
A simpler solution will return the desired result, you do not need to use %in%
twice:
asd[!(asd %in% asd1)]
[1] "A"
推荐阅读
- typescript - 分解为预先声明的变量数组的类型注释是否存在一些语法?
- android - 在单元测试中将 StateFlow 观察为 LiveData
- ios - 使用 PHPickerViewController SwiftUI 编辑图像
- sql - 查询未返回预期数据
- java - 调用 GET 请求后出现错误请求
- c - LZMA 解压算法是如何工作的?
- jenkins - 在 Jenkins CI/CD 中回滚到以前的部署版本
- go - 在 go 函数注释中编写代码块的正确方法是什么?
- c++ - 指针指向指针。我们能走多远?
- c - 使用增量运算符时的不同结果(arr[i++] vs arr[i]; i++;)