Data Science Desktop Survival Guide
by Graham Williams |
|||||
Pipes: Assignment Pipe |
ods <- ds
|
# Report on the dimensions of the dataset.
dim(ds)
# Demonstrate an assignment pipeline.
ds %<>% filter(rainfall==0) %>% select(min_temp, max_temp, sunshine) # Confirm that the dataset has changed. dim(ds)
Once again this is so-called syntactic sugar. The core assignment command is effectively translated by the computer into the following code (noting we did a little more that just the assignment in the above cod block). |
# Functional form equivalent to the pipeline above.
ds <- select(filter(ds, rainfall==0), min_temp, max_temp, sunshine)
|
ds <- ods
|