Вот более подробное объяснение, основанное на комментарии erasmortg.
library(dplyr)
#* Works
mtcars %>%
mutate(am = factor(am, 0:1, c("Automatic", "Manual")))
#* Fails: the interpreter looks at the end of the first
#* line and sees no operator, so it prints 'mtcars'
#* and declares the operation complete.
#* It then looks at the second line and can't find
#* the left hand side for '%>%', causing an error.
mtcars
%>% mutate(am = factor(am, 0:1, c("Automatic", "Manual")))
#* Fails: Similar story to the previous example. In this case,
#* printing is delayed until all of the statements within
#* the braces successfully run.
{mtcars
%>% mutate(am = factor(am, 0:1, c("Automatic", "Manual")))}
#* Succeeds: The interpreter sees that you've opened
#* with parentheses, and tries to connect all of the
#* lines into a coherent statement. With the parentheses,
#* when the interpreter sees no operator at the end of
#* 'mtcars', it says to itself, "I hope I find one on the
#* next line" and tries to piece it together.
(mtcars
%>% mutate(am = factor(am, 0:1, c("Automatic", "Manual"))))
Не могли бы вы предоставить информацию о «dataSetSubsetting», что вы пытаетесь достичь и каков ваш ожидаемый результат !? – Cleb
@Cleb Его набор данных I подмножество (dataframe). Затем мне нужно снова подмножить его и применить некоторую функцию. Это не более того. – Stophface
Что такое сообщение об ошибке? Вы проверили в 'sessionInfo()', чтобы случайно не загружать 'dplyr' и маскировать'%>% 'таким образом ... – drmariod