Reputation: 37
How would I rewrite the below code using %<>%
?
The new value of cemetaries
will be the result of...
cemetaries <-
Start with cemetaries, AND THEN...
cemetaries %>%
SELECT 3 COLUMNS, THEN EVERTHING ELSE, AND THEN...
select(LEGAL, OWNER, PROJECT, everything())
Upvotes: 0
Views: 73
Reputation: 389325
You could replace the pipe operator (%>%
) with %<>%
.
cemetaries %<>% select(LEGAL, OWNER, PROJECT, everything())
The benefit of using %<>%
is that it by default updates the lhs object so that you don't have to do cemetaries <-
.
When you use pipe operator to save the changed object back you need to do :
cemetaries <- cemetaries %>% select(LEGAL, OWNER, PROJECT, everything())
cemetaries <-
part can be avoided if you use %<>%
.
Upvotes: 3