I have been interested in studying R programming language recently and I came through this line of code which I am not understanding.
rugbyData <- rugbyHTMLData %>% html_nodes("table.wikitable") %>% .[[3]] %>% html_table
What does %>% means?
I have been interested in studying R programming language recently and I came through this line of code which I am not understanding.
rugbyData <- rugbyHTMLData %>% html_nodes("table.wikitable") %>% .[[3]] %>% html_table
What does %>% means?
In R, %>% is the pipe operator.
It enables you to chain operations in a data pipeline, as the output of every step becomes the input of the next step.
Without it the code would look like this:
rugbyData <- rugbyHTMLData
extracted_nodes <- html_nodes(rugbyData, "table.wikitable")
selected_node <- extracted_nodes[[3]]
final_result <- html_table(selected_node)
...code that creates 3 useless variables
Note the "." that is a placeholder to say "the piped object goes here".
It's provide by the magrittr package →Reference
NB: why magrittr ? → "Ceci n'est pas une pipe / This is not a pipe"