当尝试将R管道操作与获得最小值组合在一起时,我遇到了这个问题。我希望这能奏效,但不能奏效。谁能向我解释为什么会这样,以及如何解决?
df <- data.frame(ID = c(1,2,3,4),
Name = c("Name1", "Name1", "Name2", "Name3"),
Value = c(10, 14, 13, 1))
df <- df %>%
filter(grepl("name1", Name, ignore.case = TRUE)) %>%
min(Value)
Error in function_list[[k]](value) : object 'Value' not found
We can
pull
the column 'Value' as avector
and get themin
Or use
summarise
The reason is that the output from the
%>%
is the full dataset, we need to extract the column with$
or[[