当 B 列和 C 列中有 2 个条件时,A 列中的最大值
Max value in column A, when 2 conditions in column B and C
我正在尝试获取“平均值”列中的最大值,但仅限于任务为“标准”且目标为“A”的行。有什么帮助吗?
假设您的数据存储在名为 df
的 data.frame
中,您可以执行以下操作:
max(df$Mean[df$Task == "Standard" & df$Target == "A])
我们也可以先filter
数据,然后max
library(dplyr)
df %>%
filter(Task == "Standard", Target == "A") %>%
summarise(Max = max(Mean))
我正在尝试获取“平均值”列中的最大值,但仅限于任务为“标准”且目标为“A”的行。有什么帮助吗?
假设您的数据存储在名为 df
的 data.frame
中,您可以执行以下操作:
max(df$Mean[df$Task == "Standard" & df$Target == "A])
我们也可以先filter
数据,然后max
library(dplyr)
df %>%
filter(Task == "Standard", Target == "A") %>%
summarise(Max = max(Mean))