I recently saw a code as shown below:

text_df %>%
unnest_tokens(word,text_df, to_lower=FALSE)

I am unable to understand the usage of %>% symbol. Aug 27, 2018 37 views

## 3 answers to this question.

The %>% is the pipe operator used to divide the code multiline pipping, this is done just to increase the usability.

It has same functioning as of <- symbol with a addition to take multiline commands answered Aug 27, 2018 by
• 3,620 points

It is a forward-pipe operator.

You can use it to pass the left-hand side input through the right-hand side operator. In mathematical terms, it is the following operation:

x%>%f which translates to f(x)

Here is a simple example, where I create a vector of values, take the root square of every number and then compute the sum:

c(1,2,3,4) %>% Map(sqrt, .) %>%  Reduce(sum, .)
# The output:  6.146264
It is very useful when you need to apply many different transformations to your data and don’t want to save the intermediate results or have many opening and closing function parentheses.

Consider writing the following:

x %>% impute %>% shuffle %>% pivot
versus the alternative:

pivot(shuffle(impute(x)))
I hope you get the point by now.

Moreover, this technique is very handy when cleaning data.

You can use it in your R session by loading the magrittr package: library(magrittr) answered Aug 29, 2018 by
• 3,690 points
%>% is called a pipe. The process of using pipe is called piping.

Piping is generally used to avoid intermediate variable creation.

It helps in faster execution and easier understanding of opeartions.

A pipe genrally follow below structure -

dataset %>% function1(dataset/list/vector) %>% function2(dataset/list/vector) %>% . . . . . .

Which follows the operation as output of function1 to function2 and so on.. answered Aug 6 by anonymous

## What are the options for deploying models in production with R?

Well, I could say that the answer ...READ MORE

## List packages are used for data mining in R?

You can refer to the following packages ...READ MORE

## What are the top packages in R for data visualization?

These are the top R packages used ...READ MORE

## What is the standard naming convention for the variables in R?

Use of period separator e.g. product.prices <- c(12.01, ...READ MORE

## Finding frequency of observations in R

You can use the "dplyr" package to ...READ MORE

## Left Join and Right Join using "dplyr"

The below is the code to perform ...READ MORE

## Plotting multiple graphs on the same page in R

If you want to plot 4 graphs ...READ MORE