##################################################
### simple example of magrittr function piping in R

f = function(x) {return(x^2)}
g = function(x,y) {return(x+y)}

library(magrittr)

x=3
y=4

## output of f(x) is first argument of call to g
f(x) %>% g(y) #g(f(x),y)


## should be the same as
x^2+y



