I want to end a pipe with an assignment operator in R.
my goal (in pseudo R):
data %>% analysis functions %>% analyzedData
where the data and the data being analyzed are like data.frame.
I tried several variations of this, each of which gave a unique error message. some iterations I've tried:
data %>% analysis functions %>% -> analyzedData data %>% analysis functions %>% .-> analyzedData data %>% analysis functions %>% <-. analyzedData data %>% analysis functions %>% <- analyzedData
Error messages:
Error in function_list[[k]](value) : could not find function "analyzedData" Error: object 'analyzedData' not found Error: unexpected assignment in: ..
Update: the way I decided to do this:
data %>% do analysis %>% {.} -> analyzedData
Thus, in order to eliminate / debug a long channel, you can delete these two lines in your channel in order to minimize code repetition and isolate the problem.
data %>% pipeline functions %>% {.}-> tempWayPoint tmpWayPoint %>% more pipeline functions %>% {.} -> endPipe
r dplyr magrittr
t.kalinowski
source share