I'm using magrittr to use the new piping functionality, and while I can use %>%, I can't use %,%. I tried the bottom example in the answer to
What is the difference between %>% and %,% in magrittr?
but I get the error Error in eval(expr, envir, enclos) : could not find function "%,%"
Can someone who can get this function to work just paste the source code so I can
`%,% <- function(...
somehow. I'm trying to just use the paste function with multiple arguments, for example I want to replace
todaysDate <- as.numeric(paste(str_sub(Sys.time(),1,4),str_sub(Sys.time(),6,7),str_sub(Sys.time(),9,10),sep=''))
with
str_sub(Sys.time(),1,4) %,% str_sub(Sys.time(),6,7) %,% str_sub(Sys.time(),9,10) %>%
paste(sep='') %>%
as.numeric()
Error in eval(expr, envir, enclos) : could not find function "%,%"
but instead I have to do
paste(str_sub(Sys.time(),1,4),str_sub(Sys.time(),6,7),str_sub(Sys.time(),9,10),sep='') %>%
as.numeric()
[1] 20141008
any help? (This is just an example function. I know paste(sep='')
can be replaced with paste0()
, etc.)